Blog Stats
  • Posts - 24
  • Articles - 0
  • Comments - 17
  • Trackbacks - 0


Sunday, July 15, 2012

Azure Virtual Machine disappeared on me

I had been putting together a solution for a client over the past few weeks using Microsoft Azure, and had been really enjoying their new Virtual Machine functionality.  The other morning I logged in to make some changes to the virtual machine and noticed it was missing!

After browsing the web and asking around, the answer is that once the free azure trial runs out, rather than charge any money Microsoft destroys the virtual machine compute instance.

The VHD is still on the Azure blob storage, but the compute instance is no more.

Well, not entirely no more - When you try to create a new Azure IaaS Virtual Machine - this time with money on the table - Microsoft Azure will inform you that the name is already taken.  

When Microsoft destroyed your machine, little pieces of Virtual Machine are still left in their infrastructure.  Now it is time to pull out Azure Power Shell to clean up the little bits of Virtual Machine still lying around so that you can get the system back to where you started.

Download and install PowerShell and the Azure Commandlets:

And when you start up PowerShell, you will need to synchronize PowerShell with your Azure Compute instance - To do this you will need your publish settings file (the same one you use to synchronize Azure with Visual Studio)  - Pull that down from here: and save that somewhere convenient.

Here are some sample Azure Commandlets for PowerShell:

But the ones you want are:

*** Connect PowerShell to your Azure instance

$cert = Get-File D:\path\my.pubsettings
Import-AzurePublishSettingsFile $cert

*** Delete the phantom azure virtual machine
Remove-AzureVM servicename -myvirtualmachine

*** You should now be able to create a new virtual machine with the same name as the old virtual machine.
*** It is possible to see the virtual machines you currently have running - strangely enough, the one that Microsoft destroyed will likely not be in this list

$myMachines = Get-AzureVM

*** This will list every active virtual machine you have on your account

Good luck!



Copyright © jkrebsbach