Manage Multiple subscriptions in Microsoft Azure PowerShell
We will try to understand if we have multiple Azure subscription in Azure PowerShell, how we need to manage these subscription.
Let us try to find problems when we have Multiple Azure subscriptions in PowerShell.
When we run any command we get results only from current subscription
Its difficult to find in which subscription our command are being executed
We need to run command “get-azuresubscription” get more details regarding our subscription in PowerShell.
http://itfreesupport.com/wp-content/uploads/2015/03/0221-300x170.pngYou can see that I have 2 subscription with ID 7045 and 68b3. We can see that 7045 subscription status has Isdefault and Iscurrent value marked as True, where as 68b3 is marked as false
We can get only subscription 7045 when use command “Get-AzureSubscription –Default” and “Get-AzureSubscription –Current”
http://itfreesupport.com/wp-content/uploads/2015/03/0223-300x182.pngNow when we run command get-azurevm we get details related to current/default subscrption(7045) only.
http://itfreesupport.com/wp-content/uploads/2015/03/0222-300x54.pngNow I tried below command and see details of other subscriptions
Select-AzureSubscription –SubscriptionName <subscriptionname>
get-azurevm
http://itfreesupport.com/wp-content/uploads/2015/03/0224-300x61.pngNow if you observe when we run “Get-AzureSubscription –Default” or “Get-AzureSubscription –Current” command we will get 7045 has changed its value to false for Iscurrent.
http://itfreesupport.com/wp-content/uploads/2015/03/0225-300x114.png