Azure PowerShell の Get-AzureSubscription でエラーが出る場合の対処(expire以外)
Get-AzureSubscription を叩くと、CredentialがExpireしたのとは違ったエラーが出ていてちょっと驚いたので対処方法をメモしておきます。
発生したエラー
Get-AzureSubscription : Failed to refresh token. AADSTS90002: No service namespace named '(略)' was found in the data store. Trace ID: (略) Correlation ID: (略) Timestamp: 2015-12-24 02:55:40Z: リモート サーバーがエラーを返しました: (400) 要求が不適切です 発生場所 行:1 文字:1 + Get-AzureSubscription | ft SubscriptionId,SubscriptionName + ~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : CloseError: (:) [Get-AzureSubscription]、AadAuthenticationFailedException + FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.Profile.GetAzureSubscriptionCommand
先日AzureADのディレクトリを削除したりサブスクリプションを削除したりしていたので、その影響でしょうか。
対処方法
%APPDATA%\Windows Azure Powershell
(C:\Users\{{ユーザー名}\AppData\Roaming\Windows Azure Powershell)
の中身を削除した後、「Add-AzureAccount」からやり直す。
あまり面倒なことにならずひと安心でした。