Multiple Azure Subscriptions

I am working writing a script that leverages with Azure IaaS via PowerShell. I also have access to multiple Azure subscriptions from my work. I found out that this can get pretty confusing pretty quick if you also move around from machine to machine like I do. Today I was working on a different machine and after I retrieved my source code from source control I started getting weird errors. Turns out the new machine was referencing a different account via the PowerShell Azure cmdlets. I neeed to reference the correct subscription so I had to run Get-AzurePublishSettingsFile again on that machine and Import-AzurePublishSettingsFile to add the subscription.

Now I can select between the two subscriptions by using Select-AzureSubscription and then verifying by issuing Get-AzureSubscription –Current

There is the concept of a default subscription in PowerShell. To change the default subscription just issue

Select-AzureSubscription -SubscriptionName "[SubscriptionName]" –Default

To view all subscription names just issue

Get-AzureSubscription | select SubscriptionName

Comments (0)