Azure Powershell - 更改目录

tr0*_*ers 7 powershell azure

当我登录到新的 Azure 门户时,我会在右上角看到一个下拉菜单,让我可以从 2 的列表中选择一个“目录”。当我使用 powershell cmdlet“Login-AzureRmAccount”登录到 azure 时,我已连接到错误的目录。如何从 Powershell 中切换到另一个目录?

Sam*_*gan 14

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

Select-AzureRmSubscription -SubscripitionID <ID of sub> -TenantId <ID of Azure Tenant>
Run Code Online (Sandbox Code Playgroud)

您实际上可以只指定租户来选择目录,而无需订阅 ID。

Select-AzureRmSubscription  -TenantId <ID of Azure Tenant>
Run Code Online (Sandbox Code Playgroud)