I had a scenario recently where I wanted to put in a safeguard for some test data that I know would ‘expire’ and the reality is I’m a horrible housekeeper in the cloud. I found that the Lifecycle Management options in Azure Storage are a way I can keep myself a good housekeeper and not set needless reminders to go clean up something.

What is Azure Lifecycle Management?

This is a policy engine that allows data to go to different tiers and eventually be removed automatically at the storage level. This is set as a property of the blob service within an Azure storage account.

Azure Storage Configuration

For an Azure Storage account, in blob service you will see that Lifecycle Management is an option there. I’m using it for Blobs but this is available in all Azure regions for General Purpose v2 (GPv2) accounts, Blob storage accounts, and Premium Block Blob storage accounts. The figure below shows the Lifecyle Management link in the configuration of the blob storage:

Azure Storage Lifecycle management rules

Once you add a Lifecycle Management rule, you are given a rather powerful set of options.  This includes moving blobs to cool storage after a specified number of days after modification, moving the blogs to archive storage after a specified number of days after modification and deleting the blog after so many days after modification.  Additionally, logic around deleting snapshots can be placed in as well. The figure below shows blobs moving through a lifecycle, deleted after 4 years with no changes:

Additionally filters can be set for exclusions and more specific configurations if different data has different lifecycle rules.

Where to use an Azure Storage Lifecycle

This is a powerful technique if all options are used (including deleting), so some consideration should be taken into account. Here are a few ideas that I have for Azure Storage Lifecycle rules:

  • For test Azure storage accounts that you know will have data sent in that you don’t want to keep for ever
  • If the blobs are written from applications, make sure they support cool and archive; as well as having them moved between through the lifecycle.
  • If you have any synchronization type of application to Azure blob that doesn’t clean up after itself, the Lifecyle Rules may be a good way to enforce that.

CAUTION: This goes without saying that this can be a very powerful technique on blob storage, so please exercise caution!

These are just a few ideas of the top of my head, but the persistent test storage account with a blob container with an aggressive delete policy may be a good mechanism to have in play.