0
0

More than 3 years have passed since last update.

Azure PowerShell Az モジュール インストール手順

Last updated at Posted at 2021-02-23

Azure PowerShell Az モジュールのインストール手順は、
https://docs.microsoft.com/ja-jp/powershell/azure/install-az-ps?view=azps-3.8.0
で案内されていますが、
Windows Server上ではひと手間必要だったので自分用にメモ

Microsoftドキュメントでは、Powershellで以下のコマンドを実行するように記載されていますが、自分の環境で警告が出て失敗します。

【実行コマンド】
if ($PSVersionTable.PSEdition -eq 'Desktop' -and (Get-Module -Name AzureRM -ListAvailable)) {
Write-Warning -Message ('Az module not installed. Having both the AzureRM and ' +
'Az modules installed at the same time is not supported.')
} else {
Install-Module -Name Az -AllowClobber -Scope CurrentUser
}

【警告画面】
image.png
WARNING: Unable to acquire token for tenant 'organizations'
WARNING: Please run 'Connect-AzAccount -DeviceCode' if browser is not supported in this session.
Connect-AzAccount : InteractiveBrowserCredential authentication failed: User canceled authentication.
At line:1 char:1
+ Connect-AzAccount
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Connect-AzAccount], AuthenticationFailedException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand

【対応】
以下のコマンドを実行
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

これをしてからAzモジュールのインストールコマンドを実行したらうまくいきました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0