Unable to Break Lease on Azure Blob Storage due to attached Virtual Machine

I recently came across a situation whereby I wasn’t able to break a lease on an old .vhd file within Blob Storage. The issue was caused by a Virtual Machine which had since been deleted but still retained a lease lock on the file.

Azure will helpfully tell you which resource has the file leased and give the error message “All selected blobs are currently leased as virtual machine disks. Breaking the leases on these blobs is not supported.”, as in the image below, but this is only so much use when the Portal refuses to actually break the lease for you.

The Solution

The fix proved to be quite straightforward if a tad frustrating in this case. To release the lease lock on the Page blob, we need to download the Azure Storage Explorer, allowing us to remove the lease despite it ‘being in use’.

  1. To install storage explorer, go to Azure Storage Explorer – cloud storage management | Microsoft Azure and download the app, use the drop-down to select your operating system and click to download
  1. Click on Connect Storage Account and add the Storage Account Name and Storage account key obtained from the Portal.
  1. Click on Add an Account to connect to your Subscription and respective Storage Accounts.
  1. Click on the Storage account you want to break the lease.
  2. Point to the Blob Container that holds the lease.
  1. Right-click and select the “Break Lease” option.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.