Cannot delete blob: There is currently a lease on the blob and no lease ID was specified in the request

后端 未结 4 1256
太阳男子
太阳男子 2021-01-04 02:10

When I attempt to delete a blob from my storage account container, I get an error message, \"There is currently a lease on the blob and no lease ID was specified in

4条回答
  •  半阙折子戏
    2021-01-04 02:42

    Alternatively, you can just kill the lease on the Blobs with PowerShell:

    (Get-AzureRmStorageAccount -Name "STORAGE_ACCOUNT_NAME" | Get-AzureStorageBlob -name "CONTAINER_NAME").ICloudBlob.BreakLease()
    

    Just realize when you do this, the VM's that use this storage will not be able to turn on. (And you should turn them off if they aren't already before you do this.

    However, if you might use the VM's again in the future this technique allows you to:

    1. Stop the VM in question.
    2. Download a copy of the VHD.
    3. Release the lease on the VHD
    4. Delete the VHD in the storage account.
    5. Insert arbitrary time period where you don't need the VM
    6. Upload the VHD to the same storage account with the same container and same file name.
    7. Start the VM back up and have it work :-).

提交回复
热议问题