Failed to delete Storage account 'xyz07bgys83j7hk'.

I was playing around with Windows Azure Virtual Machines the last couple of days and after deleting a bunch of them I noticed I had some storage containers that were obviously related but no longer necessary. The most obvious thing to do at this stage is to delete them right? That’s too simple (but actually still correct). If you are reading this post it’s because you most likely tried the obvious way to delete the storage items:

image

So the error you get is:

“Storage account xyz07bgys83j7hk has 1 container(s) which have an active image and/or disk artifacts. Ensure those artifacts are removed from the image repository before deleting this storage account.”

This makes perfect sense since the vhd’s are stored in blobs in the storage container. Now before you rush off to delete the blobs or the containers, that will require some fancy powershell commands to remove the leases… uff to much work for me. 

What you really need to do is go to the Virtual Machines tab again and look under Disks. You will notice that if the disk is attached it will say so in the column, the rest are either orphaned or not currently in use and you can decide which to delete.

image

At this point you can also delete both the disk and the corresponding blob and container. Smart right!

image