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 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’.
- 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
- Click on Connect Storage Account and add the Storage Account Name and Storage account key obtained from the Portal.
- Click on Add an Account to connect to your Subscription and respective Storage Accounts.
- Click on the Storage account you want to break the lease.
- Point to the Blob Container that holds the lease.
- Right-click and select the “Break Lease” option.