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
3,294 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 27, 2018 in Azure by null_void
• 3,220 points
1,222 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 22, 2018 in Azure by null_void
• 3,220 points
684 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, 2019 in Azure by Prerna
• 1,960 points
1,140 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, 2019 in Azure by Perry
• 17,100 points
1,242 views
0 votes
0 answers

Is there any way for accessing the pipeline in Azure VM

I want to know like I have ...READ MORE

Sep 22, 2020 in Azure by nidhi
• 120 points
589 views
0 votes
1 answer
0 votes
1 answer

How to delete a deployment from the deployment history in Azure?

Hi@akhtar, A template deployment that is currently running ...READ MORE

answered Nov 16, 2020 in Azure by MD
• 95,460 points
1,970 views
0 votes
1 answer

Reset the SSH configuration on a VM in Azure.

Hi@akhtar, It is required to change the SSH ...READ MORE

answered Nov 18, 2020 in Azure by MD
• 95,460 points
1,483 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
2,658 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
21,902 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP