Azure PowerShell 1.3.0: PowerShell Gallery からのインストールを強化

執筆者: Mark Cowlishaw (Senior Software Engineer, Azure Tools)

このポストは、3 月 30 日に投稿された Azure PowerShell 1.3.0 – PowerShell Gallery installation improvements の翻訳です。

 

Azure PowerShell は、Azure Resource Manager (ARM) と Azure Service Management (RDFE) によって Azure の資産を管理するための PowerShell コマンドレットのセットです。このコマンドレットは、Microsoft Web Platform InstallerAzure PowerShell GitHub リポジトリの MSI インストーラー (英語)PowerShell Gallery (英語) からインストールできます。リリース 1.3.0 では、PowerShell Gallery からのインストールが大幅に改善されました。

AzureRM: Azure Resource Manager コマンドレットがさらにすばやく簡単にインストール可能に

AzureRM モジュール (英語) は、Azure Resource Manager (ARM) による Azure の資産管理に必要なすべてのコマンドレットをまとめたものです。すべての Azure Resource Manager コマンドレットをダウンロードしてインストールするには、管理者権限で Windows PowerShell か Windows PowerShell Integrated Scripting Environment (ISE) プロンプトを開き、PowerShell Gallery コマンドレット (英語) を使用して AzureRM モジュールをインストールします。

Azure Resource Manager コマンドレットをダウンロード/インストールする際に、その他のコマンドレットを実行する必要はなくなりました。

まず、管理者権限で Windows PowerShell または Windows PowerShell Integrated Scripting Environment プロンプトを開きます。

db26f7ed-0c44-40bb-9fca-66e43f853e8f

次に、Install-Module コマンドを実行して、すべての Azure Resource Manager コマンドレットをダウンロードしてインストールします。

 PS C:\> Install-Module AzureRM

PSGallery リポジトリを信頼済みリポジトリとして設定していない場合は、次のようなプロンプトが表示される可能性があります。

 Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its
InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from
'PSGallery'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): Y

「Y」と入力してから Enter キーを押し、AzureRM モジュールとすべての Azure Resource Manager コマンドレットをダウンロードします。ダウンロードしたコマンドレットはすぐに使用することが可能です。

 PS C:\> Login-AzureRmAccount

従来のコマンドレットのサポート

Azure モジュールは、Service Management (RDFE) API によって Azure の従来の資産を管理するためのすべてのコマンドレットをまとめたものです。これと同等の操作は、Azure クラシック ポータルを使用してインタラクティブな方法で実行することもできます。前述の場合と同様に、すべての Service Management コマンドレットをインストールするには、管理者権限で Windows PowerShell または Windows PowerShell Integrated Scripting Environment (ISE) プロンプトを開き、PowerShell Gallery コマンドレット (英語) を使用して Azure モジュールをインストールします。

まず、管理者権限で Windows PowerShell または Windows PowerShell Integrated Scripting Environment プロンプトを開きます。

2288723b-7c02-41ac-896e-92a1c8d3cdad

次に、Install-Module コマンドを実行して、すべての Service Management コマンドレットをダウンロードしてインストールします。

 PS C:\> Install-Module Azure

PSGallery リポジトリを信頼済みリポジトリとして設定していない場合は、次のようなプロンプトが表示される可能性があります。

 Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its
InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from
'PSGallery'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): Y

「Y」と入力してから Enter キーを押し、AzureRM モジュールとすべての Azure Resource Manager コマンドレットをダウンロードします。ダウンロードしたコマンドレットはすぐに使用することが可能です。

 PS C:\> Add-AzureAccount

モジュール管理の変更点 (PowerShell 3 と PowerShell 4 のユーザー向け)

AzureRM モジュールでは、参照する各 Azure Resource Manager モジュールのバージョン範囲を指定するためのモジュール マニフェストの形式が変更されています。この変更は、Windows PowerShell 3 と Windows PowerShell 4 で明示的なモジュール管理を行うためのコマンドレットと互換性がありません。つまり、Windows PowerShell 3 または Windows PowerShell 4 のプロンプトで Import-Module Azure コマンドを使用して、AzureRM モジュールを明示的にインポートすることはできません。

ただし、モジュールは PSModulePath に自動的にダウンロードされるため、AzureRM モジュールを明示的にインポートする必要はありません。インストール後、コマンドレットはすぐに実行することが可能です。

注: Azure Resource Manager コマンドレットを Microsoft Web Platform Installer または Azure PowerShell GitHub リポジトリの MSI インストーラー (英語) からインストールする場合は、この変更による影響はありません。

新しい AzureRM モジュールの管理に Import-Module および Remove-Module コマンドレットを使用する場合は、Windows Management Framework 5 (英語) にアップグレードする必要があります。