Managing Multiple Azure Subscriptions from PowerShell…

Hi folks, Jason here again – this time with some Azure PowerShell goodness to share.

A while back I set up an Azure trial subscription.  Following Jeremy’s post last year, “How to manage Azure from PowerShell on your PC“, I was able to get PowerShell to connect to my free trial subscription, creatively named “Free Trial”.  Coretek was kind enough to provide me with an MSDN Premium license.  Since the MSDN Azure subscriptions get $99 a month in Azure credit, it was high time to switch over to that Azure account and leverage that credit!  This subscription was also creatively named… “Visual Studio Premium with MSDN”.

Once again I followed Jeremy’s steps to import the Azure Publish Settings file – this time for the new subscription.  I ran Get-AzureVM… but I wasn’t seeing any VMs for my MSDN subscription.  Take a look:

…In the above screen capture, XENAPP1 is a VM in my old, un-loved Free Trial subscription.  Running Get-AzureSubscription showed me that I did indeed have access to two subscriptions, as expected:

So that begged the obvious question… how do I connect to my VMs in my other subscription?  Well that’s easy enough to do.  Just run the following cmdlet:

Select-AzureSubscription –SubscriptionName “Visual Studio Premium with MSDN”

…of course, change the subscription name to match your own.  NOTE: the subscription name is case sensitive!

One more tip for you, Dear Reader.  If you close your Azure PowerShell window and come back, it will revert back to whatever subscription is the default subscription.  That will always be the first subscription you set up.  The fix is simply adding the –Default switch to the end of the above cmdlet.  Now that’ll be where your Azure cmdlets do their magic as you go forward.

Now when I run Get-AzureVM I get the VMs I am looking for:


2017-07-27T00:01:01+00:00 July 24th, 2014|Uncategorized|

About the Author: