PowerShell and Azure: some gotchas

Elsewhere I’ve referenced Keith Mayer. As I needed to remind myself how I did a backup, I started out with “his” suggested first command…


However… that gave me this one:

Get-AzureVM : No current subscription has been designated. Use Select-AzureSubscription -Current <subscriptionName> to
set the current subscription.



So try that, although at first I have no idea of my subscription…


Mystery solved, I think: in fact when you go into PowerShell for Azure, the first thing you need to do is not any of the Subscription-sounding functions, but this, i.e. enter


, that takes you to a credentials dialogue. Once you OK that, it confirms all your details:


But Get-AzureVM still didn’t work… well it didn’t find it, more accurately. So I downloaded it (Azure for PowerShell), and this time it was found. The old blog page gave me the rest of it, more or less.. Here’s where I am now, finishing for the night:

AzureS204 AzureS205 AzureS206 AzureS207

This, in fact is a useful piece:


April 2015

I see that the error message has been made more helpful when your credentials have expired when entering [Get-AzureVM], in that it actually tells you what to do now:


Get-AzureVM : Your Azure credentials have not been set up or have expired, please run Add-AzureAccount to set up your Azure credentials.


Now run Get-AzureVM again, and they changed the formatting a bit as well:


So in summary, after you’ve been away a while, the 2 commands to get to a point where you list your VMs are:


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s