How do I delete an Azure storage account containing a leased blob?

The key to the solution is the message that the container has an active disk artifact and the advice to remove it from the repository.

The procedure to remove the disk image from the blob repository is:

  • Go to the Windows Azure Management Portal.
  • Click on Virtual Machines.
  • Click on Disks.
  • Click on the disk.
  • Click on Delete Disk.

After that, the storage account can be deleted.

Notes:

  • This applies even if you've already deleted all of your Virtual Machines and it shows 0; there still will be artifacts under the disks tab.
  • Disks are detached from a deleted VM asynchronously, it may take a few minutes after the VM is deleted for this field to clear up.

See also: Unable to delete VHD, “There is currently a lease on the blob…”


Unfortunately, Fernando's answer didn't work for me, since the storage was "orphan", as I deleted its VM before deleting the storage. I couldn't find a way to do it from the portal so I've installed azure-cli, and after authentication ran the following commands:

azure storage account delete <my-account>

This fails, and the error message contains the name of culprit, e.g.:

error: Storage account <my-account> has some active image(s) and/or disk(s), e.g. <my-image>. Ensure these image(s) and/or disk(s) are removed before deleting this storage

Then I deleted the offending image

azure vm disk delete <my-image>

And tried again to delete the storage, this time successfully.

azure storage account delete <my-account>


Unfortunately there is the case where the VM was deleted but Disks shows the VM attached to the blob (a 30GB VHD) precluding the deletion. Also there is the case of using the Azure Storage Explorer you find an orfan but leased VHD blob that can't be deleted and there is no reference on the Preview Portal.