Share via


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.

  1. When we run any command we get results only from current subscription

  2. Its difficult to find in which subscription our command are being executed

  3. 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.png

  4. You 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

  5. 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.png

  6. Now 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.png

  7. Now 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.png

  8. Now 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