Connect-AzAccount:「Connect-AzAccount」という用語は、コマンドレット、関数、スクリプトファイル、または操作可能なプログラムの名前として認識されません。

プラディープ

インラインモードでPowerShellタスクを使用して、AzureDevOpsパイプラインで次のPowerShellスクリプトを実行しようとしています。

$clientId= "xxxxxxxxx"
$clientSecret= "xxxxxxx"
$subscriptionId= "xxxxxxxx"
$tenantId= "xxxxxxxxxxxxx"
# sign in
Write-Host "Logging in...";
$SecurePassword = $clientSecret | ConvertTo-SecureString -AsPlainText -Force
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $clientId, $SecurePassword
Connect-AzAccount -ServicePrincipal -Credential $cred-Tenant $tenantId 
# set azure context with  subscriptionId
Set-AzContext -SubscriptionId $subscriptionId
# select subscription
Write-Host "Selecting subscription '$subscriptionId'";
Select-AzSubscription -SubscriptionId $subscriptionId;

しかし、次のエラーが発生します。

Connect-AzAccount:「Connect-AzAccount」という用語は、コマンドレット、関数、スクリプトファイル、または操作可能なプログラムの名前として認識されません。名前のスペルを確認するか、パスが含まれている場合は、パスが正しいことを確認して、再試行してください。

Krzysztof Madej

プリインストールされているモジュールがあるのでAzurePowershellTaskに切り替えることをお勧めします

ここに画像の説明を入力してください

ここに示されているように、モジュールを自分でインストールすることもできますが、既存のタスクを活用できるため、これは無意味です。

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

Related 関連記事

ホットタグ

アーカイブ