none
Error deleting VHD: There is currently a lease on the blob and no lease ID was specified in the request

    Question

  • UPDATE 10/08/2013: There are currently no scenarios where manually breaking the lease via script or CloudXplorer, etc. is useful in resolving this issue, so the script has been removed from this post.

    When attempting to create a VM using a VHD that was previously used by a different VM, you may receive the following error:

    A lease conflict occurred with the blob <blob url>

    This error is expected if an existing VM is using a disk, or if you are attempting to delete a VHD and it is still registered in the portal as either a disk or image under Virtual Machines, Disks or Images.

    If you receive this error, first make sure the VHD is not in use by a VM:

    1. In the Windows Azure management portal, if the disk shows up under Virtual Machines, Disks, and the Attached To column is not blank, you should first remove that VM in the Attached To column by going to VM Instances, selecting the VM, then clicking Delete.
       
    2. If Attached To is blank, or the VM in the Attached To column was already removed, try removing the disk by highlighting it under Disks and clicking Delete Disk (this will not physically delete the VHD from blob storage, it only removes the disk object in the portal). If you have multiple pages of disks it can be easier to search for a specific disk by clicking the magnifying glass icon at the top right.
       
    3. If Delete Disk is grayed out, or the disk is not listed under Disks, but you still cannot reuse it or delete it, review the options below.
       


    Alternate method: make a copy of the VHD in order to reuse a VHD with a stuck lease

    If you have removed the VM and the disk object but the lease remains and you need to reuse that VHD, you can make a copy of the VHD and use the copy for a new VM:

    1. Download CloudXplorer. This will work with other Windows Azure Storage Explorers but for the sake of brevity these steps will reference CloudXplorer.
       
    2. In the Windows Azure management portal, select Storage on the left, select the storage account where the VHD resides that you want to reuse, select Manage Keys at the bottom, and copy the Primary Access Key.
       
    3. In CloudXplorer, go to File, Accounts, New, Windows Azure Account and enter the storage account name in the Name field and the primary access key in the Secret Key field. Leave the rest on the default settings.
       
    4. Expand the storage account in the left pane in CloudXplorer and select the vhds container (or if the VHD in question is one uploaded to a different location, browse to that location instead).
       
    5. Right-click the VHD you want to reuse (which currently has a stuck lease), select Rename, and give it a different name. This will throw the error could not rename…there is currently a lease on the blob… but click Yes to continue, then View, Refresh (F5) to refresh and you will see it did make a copy of the VHD since it could not rename the original.
       
    6. In the Azure management portal, select Virtual Machines, Disks, then Create Disk at the bottom.
       
    7. Specify a name for the disk, click the folder icon under VHD URL to browse to the copy of the VHD you just created, check the box for This VHD contains an operating system, select the drop-down to specify if it is Windows or Linux, then click the arrow at the bottom right to create the disk.
       
    8. After the portal shows Successfully created disk <diskname>, select New at the bottom left of the portal, then Virtual Machine, From Gallery, My Disks, and select the disk you just created, then proceed through the rest of the wizard to create the VM.
       

    Thanks,
    Craig


    Monday, July 30, 2012 2:47 PM
    Moderator

All replies

  • Doug Mahugh has posted similar instructions for Node.js enthusiasts.

    Wednesday, August 01, 2012 11:56 PM
  • I ran the PS script and it tells me that the VHD file stored in Blob is tied to a OS Image with the name "" (No name). I can not determine how to delete the VHD based in the fact that somehow the blob lease is tied to an OS image with no name.
    Friday, August 10, 2012 7:02 AM
  • I ran the PS script and it tells me that the VHD file stored in Blob is tied to a OS Image with the name "" (No name). I can not determine how to delete the VHD based in the fact that somehow the blob lease is tied to an OS image with no name.

    same thing is happening to me. this is the error message that i'm getting:

    The blob is still registered as an OS image with name 'CANONICAL__Canonical-Ubuntu-12-04-amd64-server-20120528.1.3-en-us-30GB.vhd MSFT__Win2K8R2SP1-120612-1520-121206-01-en-us-30GB.vhd MSFT__BizTalk-Server-2010R2-CTP-3.10.77.0-07162012-en-us-50GB.vhd MSFT__Windows-Server-2012-Datacenter-201208.01-en.us-30GB.vhd MSFT__Sql-Server-11EVAL-11.0.2215.0-08022012-en-us-30GB.vhd MSFT__Win2K8R2SP1-Datacenter-201207.01-en.us-30GB.vhd OpenLogic__OpenLogic-CentOS-62-20120531-en-us-30GB.vhd SUSE__openSUSE-12-1-20120603-en-us-30GB.vhd SUSE__SUSE-Linux-Enterprise-Server-11SP2-20120601-en-us-30GB.vhd'.  Please delete the OS image first.

    what the hell is going on? i've never created any of these images.

    ok. each of these vhds in the error message is associated with one of the platform images in the gallery. why am i getting this error message when i'm trying to delete one of my own vhds?




    • Edited by atilekt Wednesday, August 29, 2012 4:57 PM
    Wednesday, August 29, 2012 4:49 PM
  • I ran the PS script and it tells me that the VHD file stored in Blob is tied to a OS Image with the name "" (No name). I can not determine how to delete the VHD based in the fact that somehow the blob lease is tied to an OS image with no name.

    same thing is happening to me. this is the error message that i'm getting:

    The blob is still registered as an OS image with name 'CANONICAL__Canonical-Ubuntu-12-04-amd64-server-20120528.1.3-en-us-30GB.vhd MSFT__Win2K8R2SP1-120612-1520-121206-01-en-us-30GB.vhd MSFT__BizTalk-Server-2010R2-CTP-3.10.77.0-07162012-en-us-50GB.vhd MSFT__Windows-Server-2012-Datacenter-201208.01-en.us-30GB.vhd MSFT__Sql-Server-11EVAL-11.0.2215.0-08022012-en-us-30GB.vhd MSFT__Win2K8R2SP1-Datacenter-201207.01-en.us-30GB.vhd OpenLogic__OpenLogic-CentOS-62-20120531-en-us-30GB.vhd SUSE__openSUSE-12-1-20120603-en-us-30GB.vhd SUSE__SUSE-Linux-Enterprise-Server-11SP2-20120601-en-us-30GB.vhd'.  Please delete the OS image first.

    what the hell is going on? i've never created any of these images.

    ok. each of these vhds in the error message is associated with one of the platform images in the gallery. why am i getting this error message when i'm trying to delete one of my own vhds?




    I have the exact same issue on one of my disks as well, is there anyway to fix this yet?
    Monday, September 10, 2012 2:46 AM
  • Same error for me, but following the instruction in this post fixed my issue. Deleting a VM will not delete the disk attached to it. You need to go the the 'DISKS' tab in the Virtual Machine area and delete those as well. 

    http://social.msdn.microsoft.com/Forums/en-US/WAVirtualMachinesforWindows/thread/96d77fe2-8b83-4750-8d33-bd34564792cb

    • Edited by TheIrbis Friday, September 14, 2012 1:06 PM
    Friday, September 14, 2012 1:03 PM
  • Same error for me, but following the instruction in this post fixed my issue. Deleting a VM will not delete the disk attached to it. You need to go the the 'DISKS' tab in the Virtual Machine area and delete those as well. 

    http://social.msdn.microsoft.com/Forums/en-US/WAVirtualMachinesforWindows/thread/96d77fe2-8b83-4750-8d33-bd34564792cb

    That is the normal fix, however at least in my case, this happened, I believe, after I had deleted the disk from the section in Virtual Machine management (There isn't a disk in VM management for it anymore). The issue seems to be that the disks are leased to the default azure images, which we can't delete our self.
    Friday, September 14, 2012 1:20 PM
  • Last post seems to be correct: This is still an issue. I do **NOT** have a Disk in the VM area with this name. Running the BreakLease PowerShell script results in the exception: "The blob is still registered as an OS image with name ''. Please delete the OS image first." As the last poster noted, I have no OS image (that I can find anyway) that shows this disk lease. I'm going to have to make a support request at this point.
    Wednesday, September 19, 2012 2:57 AM
  • Stupid support agent ... he is claiming he can't help me because my issue is in beta/preview. Uh ... well ... Last time I checked, Azure Blob Storage was not in beta/preview! This is a blob issue ... not a VM issue. I'm paying $3.75/month to store a 30GB blob that I can't delete because Azure has a fault. I'll post back when MS support gets their act together.
    Wednesday, September 19, 2012 4:24 AM
  • I have been using the .Net API as I got the same error on the PowerShell script.

    I'm using 1.7.1 but I think the below code is exactly the same for 1.7.0.

    I'm working on a simple tool that will kill these Leases.  I have also seen stuck Disks that cannot be removed, other than using PowerShell.

    I have a simple tool that does this that I hope to post soon.  If you want it now, just email me.

    CloudStorageAccount sourceStorageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("SourceStorageConnection"));
    
    // Create the blob client using the Accounts above
    CloudBlobClient sourceBlobClient = sourceStorageAccount.CreateCloudBlobClient();
    
    CloudBlobContainer sourceContainer = sourceBlobClient.GetContainerReference("vhds");
    
    CloudBlob sourceBlob = sourceContainer.GetBlobReference(VHDNAME.vhd);
    
    TimeSpan breakTime = new TimeSpan(0, 0, 1);
    
    sourceBlob.BreakLease(breakTime);
    


    Stephen W. Thomas 8 Year BizTalk Server MVP http://www.BizTalkGurus.com

    • Proposed as answer by SellRex Wednesday, September 19, 2012 4:51 PM
    Wednesday, September 19, 2012 7:24 AM
  • MS Azure Support just had me attempt to use myAzureStorage BlobBrowser at https://www.myazurestorage.com; however, it also gave me the same exception as the Preview UI. I did get a full stack trace this time just for fun, which I'll paste below.

    I like your code. I'll give that a shot and see what happens - thanks.

    Luke

    Server Error in '/' Application.

     The remote server returned an error: (412) There is currently a lease on the blob and no lease ID was specified in the request..
     Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.           

     Exception Details: System.Net.WebException: The remote server returned an error: (412) There is currently a lease on the blob and no lease ID was specified in the request..

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [WebException: The remote server returned an error: (412) There is currently a lease on the blob and no lease ID was specified in the request..]
       System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) +3236201
       Microsoft.WindowsAzure.StorageClient.EventHelper.ProcessWebResponse(WebRequest req, IAsyncResult asyncResult, EventHandler`1 handler, Object sender) +80

    [StorageClientException: There is currently a lease on the blob and no lease ID was specified in the request.]
       Microsoft.WindowsAzure.StorageClient.Tasks.Task`1.get_Result() +95
       Microsoft.WindowsAzure.StorageClient.Tasks.Task`1.ExecuteAndWait() +201
       Microsoft.WindowsAzure.StorageClient.CloudBlob.DeleteIfExists(BlobRequestOptions options) +213
       MyAzureStorage.Controllers.BlobsController.Delete(String uri) in D:\proj\myazurestorage-v1\managed\development\MyAzureStorage\main\code\MyAzureStorage\Controllers\BlobsController.cs:141
       lambda_method(Closure , ControllerBase , Object[] ) +127
       System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +248
       System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +39
       System.Web.Mvc.<>c__DisplayClassd.<InvokeActionMethodWithFilters>b__a() +125
       System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +640
       System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +312
       System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +691
       System.Web.Mvc.Controller.ExecuteCore() +162
       System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__4() +58
       System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +20
       System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +469
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +375

    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272

    Wednesday, September 19, 2012 4:19 PM
  • It looks like BreakLease is new in 1.7.1 ... I'm using 1.7.0, and the method is not here. I'll have to compile up a 1.7.1 to try it out.
    Wednesday, September 19, 2012 4:26 PM
  • YES! Stephen, I'm officially naming you in this thread as "THE MAN!"

    Stephen's code works. Get the Storage Client version 1.7.1 (there is no BreakLease method in 1.7.0) from GitHub at: https://github.com/WindowsAzure/azure-sdk-for-net

    Open and compile the project in the microsoft-azure-api folder

    Replace your 1.7.0 dll with the 1.7.1 dll in your project.

    For those using VB.NET, use this:

    Dim sourceBlobClient As New CloudBlobClient("http://YOUR_BLOB_ACCT.blob.core.windows.net/", New StorageCredentialsAccountAndKey("YOUR_BLOB_ACCT", "YOUR_ACCT_KEY"))
    Dim sourceContainer As CloudBlobContainer = sourceBlobClient.GetContainerReference("vhds")
    Dim sourceBlob As CloudBlob = sourceContainer.GetBlobReference("YOUR_STUCK_BLOB_NAME")
    Dim breakTime As TimeSpan = New TimeSpan(0, 0, 1)
    sourceBlob.BreakLease(breakTime)

    For those using C#, use Stephen's code above.

    Once you run the code, you will be able to use the Preview UI to delete the unlocked blob. Note that you must drop the disk if this is VHD blob attached to a VM ... make sure you've done that first in the VM area of the UI under the Disks tab. When the blob is only showing up in storage and nowhere else, then you can break the lease and kill it.

    Wednesday, September 19, 2012 4:51 PM
  • I had a similar issue and the breaking lease script didn't work. I eventually fixed my problem.

    My symptoms:

    When I tried to delete the Virtual Machine Disk, the delete icon was grayed out.
    When I tried to delete the blob storage, I would get a no lease ID on the blog
    When I ran the break lease powershell, I got the error message:

    Reading storage account information...
    Confirmed - storage account 'portalvhds8w9nk13lyf9h5'.
    Checking whether the blob is currently registered as a disk or image...
    The blob is still registered as a disk with name 'OGDemo-OGDemo-0-20120724172512'.  Please delete the disk first. 

    ARGHH. It was a circular argument. I cant delete the Disk because the blob has a lease. I cant break the lease because the blog still has a disk attached! @#$&@!!!

    My solution --

    1. Run Remove-AzureDisk from the AzurePowerShell like this:

    PS C:\> Remove-AzureDisk -DiskName "OGDemo-OGDemo-0-20120724172512" –DeleteVHD

    It processed like this:

    OperationDescription                    OperationId                             OperationStatus
    --------------------                    -----------                             ---------------
    Remove-AzureDisk                        2f004d86-779d-41e3-9850-224ab49223f8    Succeeded
    Remove-AzureDisk : There is currently a lease on the blob and no lease ID was specified in the request.

    It succeeded to removed the disk but still failed with the lease ID.

    But wait! In the Azure Portal, the Virtual Machine Disk has disappeared.

    I could then go to the storage and delete the Azure storage using the Azure Portal

    Mission accomplished for me..

    Dear Azure Team -- This is stupid. Please fix stuff like this. Delete should just delete stuff. 

    • Proposed as answer by ΕΨΗΕΛΩΝ Thursday, September 27, 2012 6:57 PM
    Monday, September 24, 2012 11:54 PM
  • YES! Stephen, I'm officially naming you in this thread as "THE MAN!"

    Stephen's code works. Get the Storage Client version 1.7.1 (there is no BreakLease method in 1.7.0) from GitHub at: https://github.com/WindowsAzure/azure-sdk-for-net

    Open and compile the project in the microsoft-azure-api folder

    Replace your 1.7.0 dll with the 1.7.1 dll in your project.

    For those using VB.NET, use this:

    Dim sourceBlobClient As New CloudBlobClient("http://YOUR_BLOB_ACCT.blob.core.windows.net/", New StorageCredentialsAccountAndKey("YOUR_BLOB_ACCT", "YOUR_ACCT_KEY"))
    Dim sourceContainer As CloudBlobContainer = sourceBlobClient.GetContainerReference("vhds")
    Dim sourceBlob As CloudBlob = sourceContainer.GetBlobReference("YOUR_STUCK_BLOB_NAME")
    Dim breakTime As TimeSpan = New TimeSpan(0, 0, 1)
    sourceBlob.BreakLease(breakTime)

    For those using C#, use Stephen's code above.

    Once you run the code, you will be able to use the Preview UI to delete the unlocked blob. Note that you must drop the disk if this is VHD blob attached to a VM ... make sure you've done that first in the VM area of the UI under the Disks tab. When the blob is only showing up in storage and nowhere else, then you can break the lease and kill it.

    Your code combined with Stephen's did the trick for me. Thank you very much!
    Thursday, September 27, 2012 5:30 PM
  • Glad I (we) could help. Hopefully, Jai sees this and his team work up something via the UI to break a lease like this. One thing for sure, nobody should create a support ticket. The support folks are clueless on this particular issue.

    Vote UP Stephen's post & mark it "Propose as Answer" --- He is the one who really figured it out and deserves all of the credit. I was just riding his coat tails.

    Thursday, September 27, 2012 6:30 PM
  • I finally posted my tool to my blog that makes working with VHD's easer.

    You can download it here: 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

    One click break of the lease.  And shows you all the lease too.

    Stephen W. Thomas


    Stephen W. Thomas 8 Year BizTalk Server MVP http://www.BizTalkGurus.com

    • Proposed as answer by johne3223 Monday, October 01, 2012 8:31 PM
    Thursday, September 27, 2012 6:39 PM
  • Steve. Thanks

    This is a great tool and worked awsome. Though it threw error first time. But then I ran it again and it worked.

    Now I am stuck with Stoarge with Container and no VHD. Cannot delete comtainer. Says

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

    Monday, October 01, 2012 8:30 PM
  • Interesting, I didn’t run into that problem.  Do you have a Disk under Virtual Machines – Disks that is orphaned? 

    Using Powershell you can go “Get-AzureDisks” to list all your disks.  (steps here: http://www.biztalkgurus.com/biztalk_server/biztalk_blogs/b/biztalk/archive/2012/09/19/how-to-remove-an-orphaned-windows-azure-virtual-machine-disk-and-remove-a-lease-conflict-on-a-vhd-blob.aspx)

    Did you close the tool down before you tried to delete the container?

    If there is a pending copy operation I think you can run into issues... but sure off hand how to check that though.  Did you try to copy anything into that container?


    Stephen W. Thomas 8 Year BizTalk Server MVP http://www.BizTalkGurus.com

    Monday, October 01, 2012 8:37 PM
  • Steve, your tool was very useful! It allowed me to delete a .vhd that was stuck.

    Now I'm having the same issue as Johne3223: "Now I am stuck with Stoarge with Container and no VHD. Cannot delete comtainer. Says There is currently a lease on the container and no lease ID was specified in the request."

    Has anyone else run into this?

    Friday, November 09, 2012 6:46 PM
  • Good to hear.

    I too have the stuck Containers. That just started happening a few weeks ago.

    Since you are not charged for having an empty container or storage account, I have not looked into how to remove them.  I just have 4 to 5 of them stacking up… for now.

    I would assume you could remove it using PowerShell, but I have been focusing on other tasks at the moment.

    One thing I do try to do is put all my VHD’s into the same storage account.  This means never use the quick create as they creates a random store per VHD (didn’t a few weeks ago but does now). 

    Hope this helps.


    Stephen W. Thomas 8 Year BizTalk Server MVP http://www.BizTalkGurus.com

    Friday, November 09, 2012 7:07 PM
  • Using Remove-AzureDisk  does indeed work, thanks!
    Tuesday, January 08, 2013 10:44 AM
  • Make sure you load the types from Microsoft.WindowsAzure.StorageClient.dll before you run the BreakLease script. If you have Azure SDK 1.8 like me then you can do this:

    Add-Type -Path 'C:\Program Files\Microsoft SDKs\Windows Azure\.NET SDK\2012-10\bin\Microsoft.WindowsAzure.StorageClient.dll'

    Then run the following to make sure the types were loaded:

    PS C:\Azure\Scripts> [Microsoft.WindowsAzure.CloudStorageAccount]

    IsPublic IsSerial Name                                     BaseType
    -------- -------- ----                                     --------
    True     False    CloudStorageAccount                      System.Object

    Thursday, February 14, 2013 12:10 AM
  • Windows Azure users using Office365 accounts to authenticate cannot follow the directions above, as they only allow Windows Live accounts (hotmail, etc.) to authenticate to download the Publish Settings File.
    Thursday, March 07, 2013 6:16 PM
  • You should be able to break the lease using my tool (http://www.biztalkgurus.com/windows_azure/m/windows_azure/37137.aspx) without needing a publishing file.  Just the Storage Account details.

    Hope this helps.


    Stephen W. Thomas 8 Year BizTalk Server MVP http://www.BizTalkGurus.com

    Thursday, March 07, 2013 10:33 PM
  • This is a link that requires a registration. Seems more like a marketing post for your tool than a download link.
    Monday, April 15, 2013 12:42 PM
  • You can get the same code on MSDN here: http://code.msdn.microsoft.com/Windows-Azure-Virtual-907e1769

    Not sure what's wrong with the link.  It should be a direct download.  This one might work better:

    http://www.biztalkgurus.com/windows_azure/m/windows_azure/37137/download.aspx

    In any event, no registration required and the source code is available for download.


    Stephen W. Thomas 8 Year BizTalk Server MVP http://www.BizTalkGurus.com

    Monday, April 15, 2013 1:49 PM
  • In the Azure management console, under Virtual Machines > Disks, I see 2 disks that both say they are attached to virtual machines. However, those virtual machines have already been deleted. Additionally, the disk blob vhds have already been deleted. So now I'm left with 2 ghost disks that cannot be removed. I'm unsure what the impact of leaving these is, and I want to remove them. When I try to remove them with remove-azuredisk, I get an error. I'm aware of the BreakLease.ps1 script, but in my case there is no VHD. The BreakLease.ps1 script appears to accept only URI as parameter, but I do not have a URI since this is not a VHD/blob.

    Does anyone have any ideas on how to get rid of these orphaned disk objects?

    Thanks!

    PS C:\> get-azuredisk | where-object {$_.diskname -like "*memb*"} | select diskname
    VERBOSE: 2:35:33 PM - Begin Operation: Get-AzureDisk
    VERBOSE: 2:35:34 PM - Completed Operation: Get-AzureDisk
    
    DiskName
    --------
    coco2008memb3-coco2008memb3-0-201307022204430928
    coco2008memb5-coco2008memb5-0-201307022204540471
    
    
    PS C:\> get-azuredisk | where-object {$_.diskname -like "*memb*"} | remove-azuredisk
    VERBOSE: 2:35:56 PM - Begin Operation: Get-AzureDisk
    VERBOSE: 2:35:57 PM - Completed Operation: Get-AzureDisk
    VERBOSE: 2:35:57 PM - Begin Operation: Remove-AzureDisk
    remove-azuredisk : "An exception occurred when calling the ServiceManagement API. HTTP Status Code: 400. Service
    Management Error Code: BadRequest. Message: A disk with name coco2008memb3-coco2008memb3-0-201307022204430928 is
    currently in use by virtual machine coco2008memb3 running within hosted service coco2008memb3, deployment
    coco2008memb3.. Operation Tracking ID: 8a8ab4956d5948ec9c23ec047259d086."
    At line:1 char:61
    + get-azuredisk | where-object {$_.diskname -like "*memb*"} | remove-azuredisk
    +                                                             ~~~~~~~~~~~~~~~~
        + CategoryInfo          : CloseError: (:) [Remove-AzureDisk], ServiceManagementClientException
        + FullyQualifiedErrorId : Microsoft.WindowsAzure.Management.ServiceManagement.IaaS.RemoveAzureDiskCommand
    
    VERBOSE: 2:35:58 PM - Begin Operation: Remove-AzureDisk
    remove-azuredisk : "An exception occurred when calling the ServiceManagement API. HTTP Status Code: 400. Service
    Management Error Code: BadRequest. Message: A disk with name coco2008memb5-coco2008memb5-0-201307022204540471 is
    currently in use by virtual machine coco2008memb5 running within hosted service coco2008memb5, deployment
    coco2008memb5.. Operation Tracking ID: 69471c6e365e4dbca7ab714dfaddbe98."
    At line:1 char:61
    + get-azuredisk | where-object {$_.diskname -like "*memb*"} | remove-azuredisk
    +                                                             ~~~~~~~~~~~~~~~~
        + CategoryInfo          : CloseError: (:) [Remove-AzureDisk], ServiceManagementClientException
        + FullyQualifiedErrorId : Microsoft.WindowsAzure.Management.ServiceManagement.IaaS.RemoveAzureDiskCommand

    Wednesday, July 03, 2013 7:13 PM
  • Then you should try the code method:

    Dim sourceBlobClient As New CloudBlobClient("http://YOUR_BLOB_ACCT.blob.core.windows.net/", New StorageCredentialsAccountAndKey("YOUR_BLOB_ACCT", "YOUR_ACCT_KEY"))
    Dim sourceContainer As CloudBlobContainer = sourceBlobClient.GetContainerReference("vhds")
    Dim sourceBlob As CloudBlob = sourceContainer.GetBlobReference("YOUR_STUCK_BLOB_NAME")
    Dim breakTime As TimeSpan = New TimeSpan(0, 0, 1)
    sourceBlob.BreakLease(breakTime)

    You do have a storage account URI. Replace "YOUR_BLOB_ACCT" above with your storage account name. Add it again with the key on the same line. Provide your stuck blob name (the name of the stuck VHD). The breaklease method is available from storage client 1.7.1 and newer.

    If you are a C# person, I think earlier in the posts there is a C# example of this code sample.

    Good luck!

    Wednesday, July 03, 2013 9:30 PM
  • Thanks for the reply.  However, I think maybe you misunderstood me (or perhaps I am misunderstanding you).  The issue I have is that there is no VHD.  The VHD has already been removed.  The VM also has already been removed.  So there's no storage account to specify because I don't need to delete anything in the storage account.  I need to delete the phantom virtual disk that appears under the "Disks" tab of "Virtual Machines" in the management console.  You'll see that these disks do not have a .vhd extension nor do they have a fully qualified name, as far as I can tell.

    Thanks.

    Thursday, July 04, 2013 12:52 AM
  • OK, so interesting news.  My internet was down for 4 hours due to a local storm.  I just got back online and logged on to the management console, and interestingly the phantom disks are now gone!  Problem solved itself, apparently. :)

    Thanks.

    Thursday, July 04, 2013 12:57 AM
  • OK, so interesting news.  My internet was down for 4 hours due to a local storm.  I just got back online and logged on to the management console, and interestingly the phantom disks are now gone!  Problem solved itself, apparently. :)

    Thanks.

    I have the same problem (No VM AND no VHD)

    Do i need a storm to fix this problem? ;-)

    How long you have wait till this phantom disks are gone?

    Monday, August 05, 2013 2:21 PM
  • Hello,

    Would it be possible for you to send me the script?

    Thanks a lot in advance

    Monday, October 14, 2013 1:33 PM
  • Excellent tool, Stephen! 

    Worked for me to break the lease for a hung blob!

    Thanks !

    Thursday, March 13, 2014 5:21 PM