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

Fernando Correia picture Fernando Correia · Jun 10, 2012 · Viewed 47.1k times · Source

I was playing with Windows Azure durable virtual machines. In the end, I deleted the virtual machine (successfully) and tried to delete the associated storage account.

The request to delete the storage account fails.

On the Preview Portal (manage.windowsazure.com) when I delete the storage account I get this error:

Failed to delete Storage account 'portalvhdscwtwycpsxxxxx'

Details:

Storage account portalvhdscwtwycpsxxxxx 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.

On the previous portal (windows.azure.com) I get this error:

Submit Failed

Storage account portalvhdscwtwycpsxxxxx 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.

Trying to delete the blob itself (a 30GB VHD) on Azure Storage Explorer I get this error:

There is currently a lease on the blob and no lease ID was specified in the request.

So my assessment is that this blob is leased (by the previous, now deleted virtual machine) and I can't delete it unless I can get this lease ID.

The question is: how can I delete this blob and, consequently, the storage account?

Answer

Fernando Correia picture Fernando Correia · Jun 10, 2012

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:

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…”