1

从具有系统分配的标识(不是用户分配的托管标识)的 VM 中。

我可以通过 az cli 通过键入进行身份验证,az login -identity并且可以基于对 VM 服务主体的 RoleAssignments 执行操作。

但是,当我尝试使用 pwsh 执行相同操作时: Connect-AzAccount -Identity出现错误:

WARNING: Unable to acquire token for tenant 'organizations' with error 'ManagedIdentityCredential authentication unavailable. No Managed Identity endpoint found.'
Connect-AzAccount: ManagedIdentityCredential authentication unavailable. No Managed Identity endpoint found.

但是,如果我Connect-AzAccount -Identity在它似乎工作后立即运行第二次:

PS /root> Connect-AzAccount -Identity

Account   SubscriptionName     TenantId                             Environment
-------   ----------------     --------                             -----------
MSI@XXXXX <subscriptionName>   <tenantId>                           AzureCloud

我可以做些什么来避免显示此警告吗?

4

1 回答 1

0

我尝试在我的本地虚拟机中使用 它进行复制,Connect-AzAccount -Identity并且第一次对我来说效果很好。

在此处输入图像描述


> WARNING: Unable to acquire token for tenant 'organizations' with error
> 'ManagedIdentityCredential authentication unavailable. No Managed
> Identity endpoint found.' Connect-AzAccount: ManagedIdentityCredential
> authentication unavailable. No Managed Identity endpoint found. ```

对于上述错误,如果为该租户或身份启用了 MFA,则会出现此类提示。这可能是您通过其登录设备的 id 启用了 MFA 的原因,直到他们将设备中的令牌指向用户进行验证,它才会发出此错误。

或者,可能是网络连接延迟或延迟,因此您第一次可能会遇到此警告。

有关更多信息,请参阅以下链接:

. 无法获取租户“组织”|GitHub 的令牌。

. Powershell Connect-AzAccount 错误| 女士问答

于 2021-09-22T08:25:12.947 回答