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

0 votes

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.

Sep 24, 2018 in Azure by null_void
• 3,220 points
426 views

1 answer to this question.

0 votes

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 :-).
answered Sep 24, 2018 by club_seesharp
• 3,450 points

Related Questions In Azure

0 votes
1 answer

Is there a logical difference between WebApp and API app in Azure?

Basically there was only minute differences between ...READ MORE

answered Apr 26, 2018 in Azure by null_void
• 3,220 points
35 views
0 votes
1 answer

Where is the storage account name and access keys on the portal?

In the image under the connection string ...READ MORE

answered May 21, 2018 in Azure by null_void
• 3,220 points
16 views
0 votes
1 answer

I want to detect whether a request is being made over HTTPS or HTTP on Azure Websites.

It's looking like you can make use of ...READ MORE

answered Apr 2 in Azure by Prerna
• 1,940 points
41 views
0 votes
1 answer

Want to make index.html as the default document on my static website in a CDN.

You can use Premium CDN. If you purchased the ...READ MORE

answered Jul 2 in Azure by Perry
• 17,020 points
19 views
0 votes
1 answer

How to upload a file on to Azure Blob storage without writing a code?

You can find the below tools useful ...READ MORE

answered Apr 13, 2018 in Azure by club_seesharp
• 3,450 points
131 views
0 votes
2 answers

How can I download a .vhd image to my local machine from azure and upload the same to a different azure account?

From the Windows Azure Portal you can ...READ MORE

answered Aug 20, 2018 in Azure by Priyaj
• 56,520 points
2,217 views
0 votes
1 answer

Error: Install-Module : The term 'Install-Module' is not recognized as the name of a cmdlet

Since you are using the lower version ...READ MORE

answered Jun 20, 2018 in Azure by null_void
• 3,220 points
1,372 views
0 votes
1 answer

Azure Blob: How to open a file in browser without downloading it?

First, because I was using a byte[] the controller ...READ MORE

answered Jun 20, 2018 in Azure by club_seesharp
• 3,450 points
2,985 views
0 votes
1 answer

Is there a way to get ERROR details on Azure website?

You have two options: First, you can turn ...READ MORE

answered May 25, 2018 in Azure by club_seesharp
• 3,450 points
131 views
0 votes
1 answer

How to get the list of names of Azure blob files in a container?

We can get some additional info like Size, ...READ MORE

answered Jun 27, 2018 in Azure by club_seesharp
• 3,450 points
990 views