如果您使用的是 REST API,当您将带有 deleted 的 blob 列为 include 参数的值之一(以便列表结果包含软删除的 blob)时,您可以通过检查两个结果中的属性:
-
Deleted-Time:它会告诉你删除 blob 的日期/时间。
-
RemainingRetentionDays:它会告诉您在剩余天数之后,该 blob 将从存储中永久删除。
来自link:
对于 2017-07-29 及更高版本,Deleted、DeletedTime 和
当此操作包括
包括={已删除} 参数。如果此 blob 不会出现这些元素
没有被删除。这些元素出现在 blob 或快照中,它们是
启用软删除功能时使用 DELETE 操作删除。
对于软的 blob 和快照,已删除元素设置为 true
删除。 Deleted-Time 对应于删除 blob 的时间。
RemainingRetentionDays 表示软化后的天数
已删除的 Blob 将被 Blob 服务永久删除。
如果您使用Azure.Storage.Blobs (.Net SDK),您将在以下属性中找到此信息:BlobItemProperties.DeletedOn 和BlobItemProperties.RemainingRetentionDays。
对于其他语言,您可以在各自的 SDK 中搜索类似的属性。
更新
请尝试以下方法:
$context = New-AzStorageContext -StorageAccountName account-name -StorageAccountKey account-key
$blobs = Get-AzStorageBlob -Container 001-000 -IncludeDeleted -Context $context
$blobs.ICloudBlob.Properties | ConvertTo-Json
输出将类似于以下内容。下面的第一个 blob 不会被删除,因此 DeletedTime 和 RemainingDaysBeforePermanentDelete 将为空。第二个 blob 被软删除,它将填充这些值。
{
"CacheControl": null,
"ContentDisposition": null,
"ContentEncoding": null,
"ContentLanguage": null,
"Length": 89,
"ContentMD5": "nax+W2kkfQqP8+K6dj2uFw==",
"ContentType": "image/svg+xml",
"ETag": "\"0x8D951D0C90A29CA\"",
"Created": "\/Date(1627481141000)\/",
"LastModified": "\/Date(1627481141000)\/",
"BlobType": 2,
"LeaseStatus": 2,
"LeaseState": 1,
"LeaseDuration": 0,
"PageBlobSequenceNumber": null,
"AppendBlobCommittedBlockCount": null,
"IsServerEncrypted": true,
"IsIncrementalCopy": false,
"StandardBlobTier": null,
"RehydrationStatus": null,
"PremiumPageBlobTier": null,
"BlobTierInferred": null,
"BlobTierLastModifiedTime": null,
"DeletedTime": null,
"RemainingDaysBeforePermanentDelete": null
},
{
"CacheControl": null,
"ContentDisposition": null,
"ContentEncoding": null,
"ContentLanguage": null,
"Length": 98024,
"ContentMD5": "/uZucSqKCO71gFpGiSkyrQ==",
"ContentType": "application/font-woff",
"ETag": "\"0x8D951D0C90AC631\"",
"Created": "\/Date(1627481141000)\/",
"LastModified": "\/Date(1627481141000)\/",
"BlobType": 2,
"LeaseStatus": 0,
"LeaseState": 0,
"LeaseDuration": 0,
"PageBlobSequenceNumber": null,
"AppendBlobCommittedBlockCount": null,
"IsServerEncrypted": true,
"IsIncrementalCopy": false,
"StandardBlobTier": null,
"RehydrationStatus": null,
"PremiumPageBlobTier": null,
"BlobTierInferred": null,
"BlobTierLastModifiedTime": null,
"DeletedTime": "\/Date(1627481162000)\/",
"RemainingDaysBeforePermanentDelete": 9
}