Azure Powershell – 更改目录

当我login到新的Azure门户时,我在右上angular看到一个允许从列表中select“目录”的下拉列表。当我使用powershell cmdlet“Login-AzureRmAccount”login到azure时,我连接到错误的目录。 我如何从Powershell中更改到其他目录?

使用Select-AzureRMSubscription时,您需要指定TenantID参数:

Select-AzureRmSubscription -SubscripitionID <ID of sub> -TenantId <ID of Azure Tenant> 

实际上,您只需指定tennant即可select目录,而无需订阅ID。

 Select-AzureRmSubscription -TenantId <ID of Azure Tenant> 

在天青门户中,请select 帮助+支持select显示诊断 。 在这里你可以findTenantID。 下一步是login。

 $Credential = Get-Credential Add-AzureRmAccount -Credential $Credential -TenantId <ID of Azure Tenant>