【问题标题】:Storage account can not be deleted with resource group无法使用资源组删除存储帐户
【发布时间】:2019-07-29 09:17:12
【问题描述】:

我们想要删除一个资源组,该资源组包含一个具有 IP 和存储帐户等的 VM。

除了存储帐户之外的所有内容都被删除,因为 vhd 表示它仍然有租约。由于以下错误消息,我无法解除租约:

Failed to break lease on 1 out of 1 blob(s):
VM2X-20170518-074152.vhd: This blob is being used by the system.

有没有办法打破租约、删除租约活动的 blob 或找出租用的位置?

附加信息: 在“编辑 blob”选项卡上的 vhd 上,我收到以下消息:

File size of '137.44GB' exceeds max supported file size of '2.1MB.'

【问题讨论】:

  • 您查看过“磁盘”吗? (您可以通过门户中的所有资源进行搜索) - 然后您可以尝试删除有问题的磁盘。我回答了一个类似的问题here - 注意 - 那是几年前的事了,门户网站看起来有点不同......

标签: azure azure-resource-group azure-storage-account


【解决方案1】:

这听起来像是经典存储帐户的一个熟悉问题,如果是我认为是问题,您将需要使用 Powershell 删除图像。

设置存储帐户

$storageAccountName = "your storage account"

检查操作系统磁盘映像

Get-AzureVmImage | Where-Object { $_.OSDiskConfiguration.MediaLink -ne $null -and $_.OSDiskConfiguration.MediaLink.Host.Contains($storageAccountName)`
                           } | Select-Object -Property ImageName, ImageLabel

检查数据盘映像

Get-AzureVmImage | Where-Object {$_.DataDiskConfigurations -ne $null `
                                    -and ($_.DataDiskConfigurations | Where-Object {$_.MediaLink -ne $null -and $_.MediaLink.Host.Contains($storageAccountName)}).Count -gt 0 `
                                   } | Select-Object -Property ImageName, ImageLabel

删除任何图像

Remove-AzureVMImage -ImageName 'yourImageName'

注意:命令是经典/ASM,请确保您已安装模块。

【讨论】:

  • 谢谢,这可能有帮助,我通过将它迁移到 ARM 并删除它来删除它,所以我无法测试你的解决方案。
  • 那么,这就是你的问题?。您必须执行上述步骤才能迁移。
【解决方案2】:

是的,您可以使用门户 UI 或 powershell 来解除租约(或 SDK)。对于门户,只需单击 blob,就会有一个打破租约的按钮。对于 powershell 是这样的:

$blob = Get-AzureStorageBlob -Context $ctx -Container %container% -Blob %blob%
$blob.ICloudBlob.BreakLease() 

【讨论】:

  • 谢谢,我在门户中尝试过,但收到了上面的错误消息。我会在 Powershell 中尝试。
  • 你不需要编辑blob,你需要去存储帐户,找到blob,点击它,然后点击打破租约按钮
  • 谢谢,我在那里打破了租约,但后来试图删除 vhd 而不是 blob
  • vhd 是一个 blob。 azure blob 存储中的任何内容都是 blob。那么你的问题解决了吗?
  • 遗憾的是没有。我现在删除了容器,但是当我想删除存储帐户时,我收到错误消息 Storage account "search5022" cannot be deleted: "The storage account "search5022" has some active images and/or media, e.g. "WkV25326-WkV2-0-201705180543020779". Remove these images and/or media before deleting this storage account.". (Code: StorageAccountOperationFailed)
猜你喜欢
  • 2014-03-13
  • 2016-07-30
  • 1970-01-01
  • 2016-03-13
  • 1970-01-01
  • 2017-06-20
  • 2021-06-10
  • 1970-01-01
相关资源
最近更新 更多