Cannot delete blob: There is currently a lease on the blob and no lease ID was specified in the request

二次信任 提交于 2019-11-30 18:14:47

You need to delete the disks from the Virtual Machines section of the portal.

  • Navigate to Virtual Machines -> Disks
  • Delete the disks

Check this MSDN blog post for the complete instructions: http://blogs.msdn.com/b/windows_azure_technical_support_wats_team/archive/2013/02/05/iaas-unable-to-delete-vhd-there-is-currently-a-lease-on-the-blob.aspx

Doug

Alternatively, you can just kill the lease on the Blobs with PowerShell:

(Get-AzureRmStorageAccount -Name "STORAGE_ACCOUNT_NAME" | Get-AzureStorageBlob -name "CONTAINER_NAME").ICloudBlob.BreakLease()

Just realize when you do this, the VM's that use this storage will not be able to turn on. (And you should turn them off if they aren't already before you do this.

However, if you might use the VM's again in the future this technique allows you to:

  1. Stop the VM in question.
  2. Download a copy of the VHD.
  3. Release the lease on the VHD
  4. Delete the VHD in the storage account.
  5. Insert arbitrary time period where you don't need the VM
  6. Upload the VHD to the same storage account with the same container and same file name.
  7. Start the VM back up and have it work :-).

You should have images associated to your VMs. Even if you have deleted your VMs, the images have to be explicitly deleted.

Once the images are deleted, you should see VHD getting cleared as well

There is an alternate (easier) way to break a lease if you use (or download) Microsoft Azure Storage Explorer (a really cool tool to manage Azure Storage).

You can browse to the Storage Account and find the relevant file (vhd) and then select the Break Lease option.

The same CAUTIONS above apply and the Explorer tool makes these clear.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!