409 Conflict cloud protocol_error ai_generated true

409 冲突:指定的租约 ID 与 Blob 快照的租约 ID 不匹配

409 Conflict: The lease ID specified did not match the lease ID of the blob snapshot

ID: cloud/azure-blob-storage-lease-conflict-on-snapshot

其他格式: JSON · Markdown 中文 · English
85%修复率
87%置信度
1证据数
2023-09-22首次发现

版本兼容性

版本状态引入弃用备注
Azure Storage REST API: 2019-07-07 active
Azure SDK for .NET: >= 12.10.0 active
Azure Portal: latest active

根因分析

当尝试删除或修改具有活动租约的 Blob 时,如果未正确提供租约 ID,操作将失败,尤其是当 Blob 具有继承或需要单独租约管理的快照时。

English

When attempting to delete or modify a blob that has an active lease, the operation fails if the lease ID is not provided correctly, especially when the blob has snapshots that inherit or require separate lease management.

generic

官方文档

https://learn.microsoft.com/en-us/rest/api/storageservices/lease-blob#status-codes

解决方案

  1. Retrieve the current lease ID by calling 'Get Blob Properties' and then use that lease ID in the delete request. Example in Azure CLI: 'az storage blob lease break --account-name <storage-account> --container-name <container> --blob-name <blob> --lease-duration -1' then delete with 'az storage blob delete --account-name <storage-account> --container-name <container> --name <blob> --lease-id <lease-id>'.
  2. If the blob has snapshots, delete the snapshots first with the same lease ID, then delete the base blob. Use 'az storage blob delete --account-name <storage-account> --container-name <container> --name <blob> --delete-snapshots include --lease-id <lease-id>'.

无效尝试

常见但无效的做法:

  1. 70% 失败

    If the lease is still active, the delete operation fails with a 409 error; the lease must be explicitly released or renewed.

  2. 90% 失败

    The Azure Storage API requires an exact lease ID match; wildcards are not supported.

  3. 60% 失败

    Snapshots may have their own leases or inherit the base blob's lease; deleting them without the correct lease ID can also fail.