Azure PowerShell – How to Change Directory

azurepowershell

When I login to the new Azure Portal I see a drop-down at the top right that lets me select a "Directory" from a list of 2. When I login to azure using powershell cmdlet "Login-AzureRmAccount" I am connected to the wrong directory. How can I change to the other directory from within Powershell?

Best Answer

You need to specify the TenantID parameter when using Select-AzureRMSubscription:

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

You can actually just specify the tennant to select the directory, without a subscription ID.

Select-AzureRmSubscription  -TenantId <ID of Azure Tenant>
Related Topic