Azure Powershell - Change Directory
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?
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>
Have a look at https://msdn.microsoft.com/en-us/library/mt125356.aspx In short, you can use the Select-AzureRmSubscription cmdlet to switch to the correct subscription.
In azure portal, select ? Help + Support select Show diagnostics. Here you find TenantID. Next step is to login.
$Credential = Get-Credential
Add-AzureRmAccount -Credential $Credential -TenantId <ID of Azure Tenant>