As a cost optimization strategy, organizations decide to retain data that are certain days old and delete the old data.
The same strategy can be implemented in Azure Storage. Let’s say if our application requires data that are 60 days old, then our approach is to retain only 60 days of data. And delete any blob that is older than 60 days.
This script deletes Azure blobs that are older than X days. Here ‘X’ is the number of days that you want to retain the data. (60, as stated in my example)
You can create an Azure Automation Runbook from this script and schedule it to run every day. So, you will not be billed for the unwanted data.