Optimize costs and manage data efficiently.
Azure Blob Storage lifecycle management offers a cost-effective way to manage the lifecycle of blobs in your storage account. You can use this feature to move blobs between different access tiers (Hot, Cool, and Archive) or to delete blobs when they are no longer needed.
By automating these actions based on rules, you can ensure that your data is always stored in the most appropriate and cost-efficient tier, and that obsolete data is removed, reducing storage costs and improving compliance.
Lifecycle management works by defining rules. Each rule consists of one or more actions that are applied to blobs that match the rule's filters.
Here's an example of a rule that moves blobs older than 30 days to the Cool tier, and then to the Archive tier after 90 days, and finally deletes them after 365 days. This rule applies to all blobs in a specific container named mydatalogs.
mydatalogsYou can also define and manage lifecycle rules using the Azure CLI. Here's a simplified conceptual example:
az storage lifecycle rule create --account-name\ --rule-name "ArchivingRule" \ --filters "{"prefix": "mydatalogs/"}" \ --actions '[{"type": "SetBlobTier", "parameters": {"tier": "Cool", "daysAfterCreationGreaterThan": 30}}, {"type": "SetBlobTier", "parameters": {"tier": "Archive", "daysAfterCreationGreaterThan": 90}}, {"type": "Delete", "parameters": {"daysAfterCreationGreaterThan": 365}}]'
Setting up lifecycle management is straightforward: