today I got hit by some serious outage on Microsoft Azure, that caused a couple of my virtual machines to be stuck in the starting stage. the problem was that there is just no way to fix this problem by using the simple tools you get in the azure portal. My servers that I use for demo purposes, needed to be up, since I was going to demo a lot of stuff in the afternoon at my Visual Studio Live! talks in Orlando.
My VM dashboard looked like this when I looked this morning:
So the question is, how the heck can you unblock these machines in this starting state, since they have been there for hours, so they are not actually starting.
the only way to fix this, was either delete the VM’s and be carful to keep the disks when deleting, or use PowerShell to stop the VM’s. Interestingly enough you can do a lot more with PowerShell then with the portal and I thought that might be the easiest way to get going again.
But since I most o the time just use the portal, I had not done any PowerShell on my brand new laptop. I think it is nice to go through the step by step process of what I needed to do in order to get things going again.
So first I needed to get the Azure PowerShell environment. The Azure PowerShell command lets are available for download, but I just got the whole package using the Windows Platform installer.
Here I selected the Azure Power tools and after that install I started a fresh command prompt.
Next I wanted to issue the Stop-AzureVM command, but in order for that command to succeed, you need to set up your subscription first.
For that you start with the command:
This command will create an UI prompt to log you on with your Azure credentials and after this succeeds you will see your subscriptions listed associated with your account.
If you have multiple subscriptions, you need to check which subscription was selected as your default. In this case I needed to select the right subscription. For this you use the command:
Select-AzureSubscription and you provide it the subscription name.
Now the default subscription is set for all subsequent azure commands.
Now I could finally issue the Stop-AzureVM command and there you need to provide it a couple of parameters. Fist you need to give it the name of the VM, tha tis easy since it is the name you see in the portal. The second question is the name of the service. The name of the service apparently is the name of the DNS for that machine, without the cloudapp.net part. So for my TFS azure machine that is called FluentbytesTFS, this was fluentbytesdc, as you can see in the picture here below.
After issuing the Stop-AzureVM command, I was able to use the portal again to start the VM’s. This time they started and all was well again.
Hope this helps you when you get your VM’s stuck, I had to search in multiple places to figure out how to make it work again.