I can see from the Azure Storage REST API documentation, that it is possible to set the expiration date of a blob at the time it is created.
Is it possible to set a newly created blob's expiration date via the Azure Blob Storage client library for .NET?
If someone has an example or link to more information, it would be appreciated.
You can use the below code to set the expiration date of a blob relative to the current time with the
requestmethod using C#.Code:
The above code adds an expiry time as a sample of (one minute) to a blob in Azure Blob Storage using a Shared Access Signature (SAS) token. The code creates an HTTP PUT request to the blob URL with the expiry time specified in the request headers.
Output:
The above code operation is allowed only on
hierarchical namespaceenabled storage accounts.Reference: Set Blob Expiry (REST API) - Azure Storage | Microsoft Learn