概要
Azure PowerShellをローカル環境にインストールする方法
必要条件
- PowerShell 5.1 以上 (Windows)
- PowerShell Core 6.x 以上 (macOS, Linux)
PowerShellのインストールはこちら
PowerShell Coreのインストールはこちら
手順
PowerShell上で以下のコマンドを実行する.
PowerShell
Install-Module -Name Az -AllowClobber
カレントユーザーにのみインストールしたい場合は以下のコマンドを実行する.
PowerShell
Install-Module -Name Az -AllowClobber -Scope CurrentUser
以下の出力が表示されるのでy
をタイプする.
Output
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"):
サインイン
以下のコマンドでサインインする.
PowerShell
Connect-AzAccount
以下のアウトプットのURLをブラウザで開いて,コードを入力する.
Output
WARNING: To sign in, use a web browser to open the page
https://microsoft.com/devicelogin and enter the <code> to authenticate.

アップデート
以下のコマンドでアップデートする.
PowerShell
Install-Module -Name Az -AllowClobber -Force