In one of my customer's application, we are storing static content (such as icons, and logos) in an Azure Storage Account blob container.
We've also configured the Cache-Control property of the blob items when served up to reduce bandwidth consumption.
Today, I wanted to show you how we did that.
The sample application is very simple: it consists of an Azure App Service hosting a static HTML page that displays an image that is stored in an Azure Storage blob.
In order to set the cache-control for the blob item manually through, you'll need to use Azure Storage Explorer (either from the standalone tool or from the Azure Portal):
![set blob properties 1]((https://dev-to-uploads.s3.amazonaws.com/i/an4yztmwod5m80oa2ylm.png)
If we have multiple items in our blob container, setting properties manually is probably not the best idea.
Luckily, we can automate this thing!
In this example, I show you how to do it in PowerShell but you can do it with whatever Azure SDK you prefer: Azure CLI, .NET, Python and so on. It's your call!
The first time we access the HTML page, we see that the image has been downloaded:
Without setting the "CacheControl" property, we would notice that, on every page refresh, the image is being downloaded again.
Today, we've seen how we can set up cache-control on blob storage items, both manually and automatically using PowerShell.
This will help lower your application's latency as well as your Azure Bandwith costs.
I hope that you found it valuable.
See you soon!