0

I have removed all my Azure VMs and now I'm trying to remove a vhds container storage blob from a classic storage account. It gives me this error:

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

I have found an article that mentions this error: https://blogs.technet.microsoft.com/thbrown/2015/04/04/there-is-currently-a-lease-on-the-blob-and-no-lease-id/

It suggest to remove VMs. I have, beforehand. Have I messed up by deleting the VM first so now I am unable to detach the image from it? Is this a bug?

Tomáš Hübelbauer
  • 9,179
  • 14
  • 63
  • 125
  • This has already been answered - look at the question linked to, which your question is a duplicate of. My answer there shows how to remove associated disks with both Classic and ARM-based storage. – David Makogon Oct 03 '16 at 02:33

2 Answers2

0

You can break the lease with powershell with the following command:

Get-AzureRmStorageAccount -Name 'mystorageaccountname' | Get-AzureStorageBlob -name 'mycontainername').ICloudBlob.BreakLease()
Peter
  • 27,590
  • 8
  • 64
  • 84
0

This is a known issue with classic VMs. Following approach worked for me:

  1. In Azure Classic Portal, go to Virtual Machines, then click on Disks
  2. Select the Disk resource you want to delete (the Attached to column should be empty)
  3. Click Delete, then Delete the associated VHD

EDIT: Please ensure that you delete the Disk Resources! By breaking the lease and just removing the VHDs without deleting disk resources there still would remain some metadata stored and you couldn't delete the storage account if you wanted to.

dotnz
  • 31
  • 1
  • 3