Impact of Soft Delete Restoration on Blob Timestamps in Azure Blob Storage

Khushaal Kurswani 50 Reputation points Microsoft Vendor
2024-12-19T03:26:27.5266667+00:00

Given that Lifecycle Managment Policy and soft deletes are both enabled and configured in an Azure Blob Storage account, I want to restore a soft-deleted blob that was deleted by Lifecycle Management Policy.

When the blob is restored, will its last modified date be set to the restoration date? Or will it retain its original last modified date? Will it retain its original created at date?

In the case that the blob retains its original last modified date and created at date, the Lifecycle Management Policy would delete the blob upon restoration because the blob would be past its retention period.

Is there any way to retain a restored blob after getting soft deleted by the Lifecycle Management Policy without it getting deleted automatically?

Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
3,000 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Keshavulu Dasari 2,420 Reputation points Microsoft Vendor
    2024-12-20T02:00:41.0866667+00:00

    Hi Khushaal Kurswani,
    You're correct that the LastModified date of a blob in Azure Blob Storage is system-managed and cannot be directly modified. The BlobProperties.LastModified property is indeed a read-only property, and there is no setter for it.

    I suggest few steps you can take to troubleshoot the issue. There are a few indirect ways to influence the LastModified date:

    Copying the Blob: You can create a copy of the blob. When you copy a blob, the new blob will have a new LastModified date corresponding to the time of the copy operation. This effectively gives you a new blob with a current LastModified date.

    Updating Metadata or Properties: Any operation that modifies the blob, including updating its metadata or properties, will change the LastModified date. For example, you can add or update a metadata key-value pair to trigger an update to the LastModified date

    Re-uploading the Blob: If you re-upload the blob, it will have a new LastModified date corresponding to the time of the upload. This is similar to copying the blob but involves uploading the data again.

    Unfortunately, for a soft-deleted blob, these operations would need to be performed after restoring the blob, as the LastModified date cannot be directly modified during the soft-deleted state.
    For more information:
    https://learn.microsoft.com/en-us/dotnet/api/azure.storage.blobs.models.blobproperties.lastmodified?view=azure-dotnet


    Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.   
    User's image        
    If you have any other questions or are still running into more issues, let me know in the "comments" and I would be happy to help you.

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.