Deleting Windows Azure Virtual Machine

As my post here, I shared a journey of creating, recreating, and deleting Windows Azure Virtual Machines in order to just install IIS. I need to rephrase here, that hassle is due to wrong selection of VM size. I rephrase, you need to choose at least the VM size of Medium (2 cores, 3.5 GB memory) in order to successfully install Windows Server OS and related services such as IIS. At least, that’s my experience at that particular time.

During the journey, 3 VMs were created. As they won’t be used, they should be deleted so that we don’t have to pay for them. Turned out, deleting VM in Azure is kinda tricky.

Obviously, logical step to delete something is selecting it, then find “delete” button. Click the button and choose “yes” when confirmation pops up.

Yes, you can delete a VM while it’s running (as picture above).

Yes, doing all that will delete the VM from Virtual Machine Instances list. Although, it’s not really deleted. Why’s that? Well, for starting, the disk used by that deleted VM still exits.

Deleting Disks

If let’s say, your VM name is “jepretdbvm“, when you click DISKS menu, you’ll find this:

There are two disks whose name prefixed “jepretdbvm”. Those two disks have to go away. Why two, not one (only the OS disk)? That’s because we choose to install system and services on OS disk, then we attach another disk dedicated for data, hence “Data disk”. If you don’t opt-in for Data disk, you’ll find only OS disk here.

To delete the disk, select it, click delete button, then choose “Delete the associated VHD”.

Is that enough? No! Actually yes, but…
If let’s say the deleted VM name is “jepretdbvm”, then the DNS name is “jepretdbvm.cloudapp.net”. If somehow you plan to use the same VM name later, hence the same DNS name, you just can’t! Even though the VM and the disk are already deleted.

Turned out, when you create a VM, a Cloud Service will be created as well, at least to my understanding. When the VM is still active, you can’t see its related cloud service in Cloud Services tab. But, after the VM is deleted, its partner in crime of cloud service will be revealed. Just go to Cloud Service tab, you’ll find a cloud service with the same name as VM name, that’s initially not there. That cloud service has to go away as well.

Deleting Cloud Service

So again, in order to completely deleting a VM, you need to delete the VM itself for Virtual Machine Instances list, then delete its related disks, and finally delete its related Cloud Service. Deleting Cloud Service is as easy as selecting it, clicking Delete button, and choose “Yes” on confirmation.

That’s it. Now, you can say good bye to that VM. Enjoy!