Break remove lease Azure blob

I encountered an error which I’ve seen before when building Azure VM’s in the “old” service manager or the classic portal. My issue is that sometimes when you remove the virtual machine the blobs in the storage account keep hanging around. You can easily sort that out by following this guide. Although when working with Resource Manager (ARM) virtual machines the disks are not seen in the classic portal. I can not therefore break the lease.

Error:

Failed to delete blob ‘vhds/<nameofblob>.vhd’. Error: There is currently a lease on the blob and no lease ID was specified in the request.

My VM attached to the storage is removed since way back and there is no other system accessing the blobs. There is a some kind of ghost lease hanging around locking the blobs.

I tried several ways to remove both the blob themselves, the storage account and the whole storage account. Both through the “new” portal.azure.com and powershell but I had no success.

Solution to break lease on blob:

I tried several third party tools that can connect to Azure storage accounts and manage  vhds. For example “Azure Storage explorer 6”, and “Cloudberry Explorer”. Although the only tool that I found that can break leases on blobs is “cloudXplorer”. So in short, download cloudXplorer and follow this guide, after that there shouldn’t be a lease on the blobs and you should be able to delete them or the whole storage account!

  1. Visit  http://clumsyleaf.com/products/cloudxplorer  and download and Install CloudXplorer.
  2. Open the Application CloudXplorer and click “Accounts”, New, Select Azure Blobs Accounts.azure break lease
  3. It will ask for keys, you can find the on the Storage Account on Portal.azure break lease
  4. Once Storage Account is mapped an Navigate to the VHD and right click and Break Lease.azure break lease
  5. Now you should be able to go back to the azure portal or run commands in powershell to remove the blobs and/or storage account.

Good Luck!

*UPDATE*

Error:

The storage account cannot be deleted due to its artifacts being in use. For more information on troubleshooting this issue, see https://azure.microsoft.com/documentation/articles/storage-cannot-delete-storage-account-container-vhd/

I’ve received the following error when trying to delete the storage account.  Which is because the container also have a lease left.

Solution to break lease on container:

You can’t remove the lease on an container or storage account from cloudxplorer or any other tool I could find. I had to contact support and their backend team removed the lease.  I will update this blog if I found out a command or tool that does this so you don’t need to open a support case.

If you don’t succeed, please drop a comment or mail, and I will be happy to help, I’ve tried most of the “solutions” 🙂