title | description | services | documentationcenter | author | manager | editor | tags | ms.assetid | ms.service | ms.workload | ms.tgt_pltfrm | ms.devlang | ms.topic | ms.date | ms.author |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Troubleshoot errors when you delete Azure storage accounts, containers, or VHDs in a Resource Manager deployment | Microsoft Docs |
Troubleshoot errors when you delete Azure storage accounts, containers, or VHDs in a Resource Manager deployment |
storage |
genlin |
felixwu |
na |
storage |
17403aa1-fe8d-45ec-bc33-2c0b61126286 |
storage |
na |
na |
na |
article |
10/17/2016 |
genli |
Troubleshoot errors when you delete Azure storage accounts, containers, or VHDs in a Resource Manager deployment
[!INCLUDE storage-selector-cannot-delete-storage-account-container-vhd]
You might receive errors when you try to delete an Azure storage account, container, or virtual hard disk (VHD) in the Azure portal. This article provides troubleshooting guidance to help resolve the problem in an Azure Resource Manager deployment.
If this article doesn't address your Azure problem, visit the Azure forums on MSDN and Stack Overflow. You can post your problem on these forums or to @AzureSupport on Twitter. Also, you can file an Azure support request by selecting Get support on the Azure support site.
When you try to delete a VHD in a storage account in a Resource Manager deployment, you receive the following error message:
Failed to delete blob 'vhds/BlobName.vhd'. Error: There is currently a lease on the blob and no lease ID was specified in the request.
This problem can occur because a virtual machine (VM) has a lease on the VHD that you are trying to delete.
When you try to delete a container in a storage account in a Resource Manager deployment, you receive the following error message:
Failed to delete storage container 'vhds'. Error: There is currently a lease on the container and no lease ID was specified in the request.
This problem can occur because the container has a VHD that is locked in the lease state.
When you try to delete a storage account in a Resource Manager deployment, you receive the following error message:
Failed to delete storage account 'StorageAccountName'. Error: The storage account cannot be deleted due to its artifacts being in use.
This problem can occur because the storage account contains a VHD that is in the lease state.
To resolve these problems, you must identify the VHD that is causing the error and the associated VM. Then, detach the VHD from the VM (for data disks) or delete the VM that is using the VHD (for OS disks). This removes the lease from the VHD and allows it to be deleted.
-
Sign in to the Azure portal.
-
On the Hub menu, select All resources. Go to the storage account that you want to delete, and then select Blobs > vhds.
-
Check the properties of each VHD in the container. Locate the VHD that is in the Leased state. Then, determine which VM is using the VHD. Usually, you can determine which VM holds the VHD by checking name of the VHD:
To delete the VM that is using the VHD (for OS disks):
- Sign in to the Azure portal.
- On the Hub menu, select Virtual Machines.
- Select the VM that holds a lease on the VHD.
- Make sure that nothing is actively using the virtual machine, and that you no longer need the virtual machine.
- At the top of the VM details blade, select Delete, and then click Yes to confirm.
- The VM should be deleted, but the VHD should be retained. However, the VHD should no longer have a lease on it. It may take a few minutes for the lease to be released. To verify that the lease is released, go to All resources > Storage Account Name > Blobs > vhds. In the Blob properties pane, the Lease Status value should be Unlocked.
To detach the VHD from the VM that is using it (for data disks):
- Sign in to the Azure portal.
- On the Hub menu, select Virtual Machines.
- Select the VM that holds a lease on the VHD.
- Select Disks on the VM details blade.
- Select the data disk that holds a lease on the VHD. You can determine which VHD is attached in the disk by checking the URL of the VHD.
- Determine with certainty that nothing is actively using the data disk.
- Click Detach on the Disk details blade.
- The disk should now be detached from the VM, and the VHD should no longer have a lease on it. It may take a few minutes for the lease to be released. To verify that the lease has been released, go to All resources > Storage Account Name > Blobs > vhds. In the Blob properties pane, the Lease Status value should be Unlocked.
A lease is a lock that can be used to control access to a blob (for example, a VHD). When a blob is leased, only the owners of the lease can access the blob. A lease is important for the following reasons:
- It prevents data corruption if multiple owners try to write to the same portion of the blob at the same time.
- It prevents the blob from being deleted if something is actively using it (for example, a VM).
- It prevents the storage account from being deleted if something is actively using it (for example, a VM).