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

非 Y 不嫁゛ 提交于 2019-12-18 18:54:14

问题


When I attempt to delete a blob from my storage account container, I get an error message, "There is currently a lease on the blob and no lease ID was specified in the request."

I have 4 virtual machine instances. I also have 8 virtual machine disks, 4 of which are in use (one by each of the virtual machine instances). Strangely, I have 10 blobs listed in my single storage account's lone container, called vhds. Here is a screenshot of the 10 blobs, highlighting the two that I cannot delete.

Can anyone give me guidance on how to delete these blobs? I have no use for them and I'd like to cut down on my storage costs for my subscription.


回答1:


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




回答2:


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 :-).



回答3:


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.




回答4:


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



来源:https://stackoverflow.com/questions/16311261/cannot-delete-blob-there-is-currently-a-lease-on-the-blob-and-no-lease-id-was-s

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