Delete old blobs
- Updated on 02 Apr 2019
- 2 minutes to read
Enterprises use Service Bus entities, Event Hubs, Storage accounts and many other Azure services to build a solution to solve a business problem. As a part of integrating these services together, it may be needed to store events, messages or other data into Storage Account Blobs. These stored blob content might not be of use after a time. Hence removing unwanted content from Azure Storage Blob becomes a business need.
This capability is not found both in the Azure portal and in the Storage Explorer. Serverless360 fills this gap with a capability to automate the process of clearing contents from Storage Account Blobs.
Consider a scenario where an application listens for messages from a Service Bus Queue or Topic Subscription and writes the messages as Page or Block blobs into a Storage Account Blob. This continuous writing of messages into the blobs will cause a drastic increase in the number of blobs inside the Storage Account Blob Container. Unlike Service Bus Queue where the messages would be removed from the Queue when the Application receives it, the blobs would retain the content even after the application had done processing it. In this scenario the blobs older than 10 days in the blob storage is no more required for the Business. Manual deletion of these old blobs is a tedious task.
Serverless360 solves this problem by providing automated activities to delete the old blobs in Storage Account Container.
Delete Old Blobs in a Storage Account Container
The Blobs can be deleted by specifying the following conditions
- Blob Created time
- Blob Modified time
- Blob Type
The blobs can be deleted either through inline or scheduled activity based on the business requirement.
Only those blobs that aren't Leased will be deleted.
All the Snapshots of the blobs will be deleted.
Delete old blobs through inline activity
If the blobs need to be deleted by specifying the created at or modified at time directly, then inline activities can be used.
Delete old blobs through scheduled activity
If the process of deleting the old blobs is repetitive, then scheduled activities can be used. In this case, specify the time duration so that the blobs created or modified (last accessed) before the specified time duration from which the activity runs will be deleted. This activity can be scheduled to run on daily or hourly basis.