Marty
Marty

Reputation: 251

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

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.

Upvotes: 20

Views: 22117

Answers (4)

Bernard
Bernard

Reputation: 1238

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.

enter image description here

Upvotes: 6

Doug
Doug

Reputation: 7107

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

Upvotes: 7

Faiz Mohamed Haneef
Faiz Mohamed Haneef

Reputation: 3596

Azure Classic Portal

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

Upvotes: 0

user793891
user793891

Reputation:

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

Upvotes: 23

Related Questions