Get-AzureSubscription:无法刷新令牌。 AADSTS90002

Get-AzureSubscription : Failed to refresh token. AADSTS90002

我在执行 Microsoft Azure powershell 命令时收到一个奇怪的错误。通过 Add-AzureAccount 成功将我的帐户添加到 shell 后,我在执行 Get-AzureSubscription 时失败。错误消息说:

Get-AzureSubscription : Failed to refresh token. AADSTS90002: No service namespace named
'[REMOVED GUID FROM QUESTION]'was found in the data store.
Trace ID: [REMOVED GUID FROM QUESTION]
Correlation [REMOVED GUID FROM QUESTION]
Timestamp: 2015-02-15 20:34:14Z: The remote server returned an error: (400) Bad Request.

我对一个帐户有多个订阅。看起来有一个租户可能在本地关联到该帐户,但在进行 REST 调用时不存在。我之前确实删除了一个 Azure AD 域。

删除文件夹C:\Users\\AppData\Roaming\Windows Azure Powershell

的内容

然后再次 运行 添加 AzureAccount 以获得新的

Wriju 的评论是正确的,除了您需要添加您正在使用的用户名文件夹这一事实。

C:\Users\{{用户名}\AppData\Roaming\Windows Azure Powershell

此外,如果您尝试通过文件资源管理器搜索它,则需要打开显示隐藏文件选项

如果按照 LaPuyaLoca 的解决方案,问题没有像我的情况那样解决,请关闭所有 powershell 运行ning 控制台并再次删除“Windows Azure Powershell”文件夹和 运行 Add-AzureAccount