Freigeben über


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

For classic VMs, there are artifacts (metadata about the VHDs) that keep a lease on the VHD even when no VM is using it.

To delete a disk or image for classic VMs, in the classic portal (https://manage.windowsazure.com/) select Virtual Machines on the left navigation pane, then select the Disks or Images tab on the right pane.

There are two types of images for classic VMs - OS images (the original type) and VM images (became available in 2014). But currently the new portal's VM Images (classic) section only shows VM images but not OS images. This is a known issue and an update is planned to allow managing both types of images for classic VMs in the new portal, but in the meantime, use the classic portal to remove the older type of images (OS images).

If you are unable to delete a storage account and the error references "artifacts", you need to remove the disk and image metadata as mentioned above. Even if you manually break the lease and delete the VHD blob, the artifacts (metadata for the disk or image) still exist and prevent you from deleting the storage account. That is why you must remove them as recommended, and just deleting the VHD blobs in Azure storage is not enough to allow the storage account to be removed.

Scenario:

After deleting a Windows Azure Virtual Machine you try to delete the blobs for the associated VHDs and receive the message below:

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

 

Root Cause:

When you delete a Virtual Machine on the Management Portal, the "Disk" resource used to mount the Virtual Machines VHD is kept.

The "Disk" resource is responsible for mounting the blob for the VHD file, so it can be attached to virtual machines as an OS Disk or Data Disk. It will continue to hold a lease on the blob for as long as it exists.

 

Resolution:

You need to delete the "Disk" resource to break the lease on the blob.

All Disks resources are found on the Management Portal under: Virtual Machines -> Disks

To delete the Disk resource follow the steps below:

  1. On the Azure Management Portal, navigate to Virtual Machines -> Disks
  2. Select the Disk you want to delete.
  3. Confirm there is no Virtual Machine listed on the "Attached to" column
    1. 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.
  4. Click "Delete" and choose if you want to "Retain the associated VHD" or "Delete the associated VHD"
    1. If you choose to "Retain the associated VHD" the lease will be removed but the blog containing the VHD will be kept in your Storage Account. You may choose this option if you plan to delete the VHD directly from your storage account VHDs container, create a new Disk pointing to the existing VHD, download to your on-premises environment or just leave it there for future use.

 

References:

How to Attach a Data Disk to a Virtual Machine
How to Detach a Data Disk from a Virtual Machine

 

Hope it helps.

Flavio Muratore
Sr. Support Escalation Engineer
Windows Azure Technical Support