Microsoft Azure VHDからOSラベル作成エラー

Add-AzureVMImage : Please connect to internet before executing this cmdlet

PowerShellから実行するとエラー出てだめだったけど

Add-AzureVMImage -ImageName イメージ名 -MediaLocation BLOB.*.vhd -Label イメージのラベル -OS Windows or Linux

ポータル画面からGUI操作ではなぜかうまくいった。。

 

Microsoft AzureをPowerShellで操作する際に表示されるエラー対処

PowerShell操作時、次のエラーが表示される。

Get-AzureVM : ForbiddenError: The server failed to authenticate the request. Verify that the certificate is valid and is associated with this su
bscription.

サブスクリプション発行設定ファイルをImportしていない状態のようです。

サブスクリプション発行設定ファイルを次のコマンドでダウンロードし

Get-AzurePublishSettingsFile

*.publishsettingsを任意のパスに保存してください。

Import-AzurePublishSettingsFile 'ファイルパス\*.publishsettings'を実施してください。

 

1つのアカウントで複数サブスクリプションを管理している場合、サブスクリプションを指定してから操作するとよさそうです。

Select-AzureSubscription -SubscriptionName 'サブスクリプション'