Hello Aparna, Welcome to MS Q&A
To set the expiration or Time to Live (TTL) for a file uploaded to Azure Blob Storage, you can use the Cache-Control header. The TTL is determined by this header in the HTTP response from the origin server. Here are several methods to set the Cache-Control header
- Azure Storage Explorer:
- Select the blob, right-click and choose Properties.
- Find the CacheControl property, enter your desired value, and save.
- Azure CLI:
- When uploading a blob, you can set the cache-control header using the -p switch. For example, to set the TTL to one hour (3600 seconds):
azure storage blob upload -c <connectionstring> -p cacheControl="max-age=3600" .\<blob name> <container name> <blob name>
- When uploading a blob, you can set the cache-control header using the -p switch. For example, to set the TTL to one hour (3600 seconds):
- Azure Storage Services REST API:
- You can explicitly set the x-ms-blob-cache-control property using operations like Put Blob, Put Block List, or Set Blob Properties.
If you do not set a TTL, Azure CDN applies a default TTL of seven days, unless caching rules are configured in the Azure portal.
References:
- Manage expiration of Azure Blob storage in Azure Content Delivery Network
- Manage expiration of web content in Azure Content Delivery Network
- Setting Cache-Control headers by using other methods
- Please check and let us know if anything needed, kindly accept if helps