When connecting to Azure with Powershell, you’ll always be connected to the default subscription.
This is not always the preferred subscription.
Here is a script how to select the preferred subscription.
Always check the selected subscription, before executing more powershell command’s.
Script
Login-AzureRmAccount $subscriptionId = (Get-AzureRmSubscription | Out-GridView -Title "Select the preferred Azure Subscription and click OK" -PassThru).SubscriptionId Get-AzureRmSubscription -SubscriptionId $subscriptionId | Select-AzureRmSubscription
This is how it looks like:
Login-AzureRmAccount
Logon with the correct credentials.
The default subscription is shown.
In the Gridview you see what the default subscription is.
Select the preferred subscription, and click OK.
The selected subscription is now the default subscription.
When checking the subscription by: Get-AzureRmContext you see the selected (new default) subscription.