Manage Multiple subscriptions in Microsoft Azure PowerShell
Hi All,
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
-
We need to run command “get-azuresubscription” get more details regarding our subscription in PowerShell.
-
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
-
We can get only subscription 7045 when use command “Get-AzureSubscription –Default” and “Get-AzureSubscription –Current”
-
Now when we run command get-azurevm we get details related to current/default subscrption(7045) only.
-
Now I tried below command and see details of other subscriptions
Select-AzureSubscription –SubscriptionName <subscriptionname>
get-azurevm
-
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.