Problem: Azure does not allow you to remove blobs from your storage account when a lease exists
Solution: Install the tool “Windows Azure Virtual Hard Disk (blob storage) Cross Account Copy, Lease Break, and Management Tool”
Download URL: http://www.biztalkgurus.com/biztalk_server/biztalk_blogs/b/biztalk/archive/2012/09/26/windows-azure-virtual-hard-disk-blob-storage-cross-account-copy-lease-break-and-management-tool.aspx


.

Unpack the VHDandVMTool.zip package and edit VHDandVMTool.exe.config in the Executable directory.

Enter your storage account Primary connection string.
You can find this string at https://portal.azure.com/
The path is Browse/Storage accounts (classic)/Select your storage account/Click All settings/Click Keys

<!-- Enter the Source Storage Account Details here. Used for VHD Operations-->
<add key="SourceStorageConnection" value="DefaultEndpointsProtocol=https;AccountName=portalvhdsnnnn;AccountKey=nnnn==" />

Start up the tool and click “START QUERY”.
At this point you will receive an error message but you can click Continue.

azure-lease-break-tool

The list of your VHD’s will be shown.
Select the VHD which lease you want to break.
Click “Break VHD Lease”

Install the Microsoft Azure Storage Client Library for Node.js
https://www.npmjs.com/package/azure-storage

$ npm install --global azure-storage

After this you can use azure-storage to delete your VHD.

$ set AZURE_STORAGE_ACCOUNT=portalvhdsnnnn
$ set AZURE_STORAGE_ACCESS_KEY=nnnn==
$ azure storage blob delete --container vhds <VHDNAME>

Advertisements