Using Lifecycle Management on Azure Blob Storage Account Containers

One of our clients wanted to set up a process to delete files from their blob storage containers after they aged beyond a certain time limit. Initially the conversation went down the route of creating some configuration information to drive the process, stored in a JSON file or a database and then periodically a process would use that configuration information to apply the rules across all the storage…I then thought hey surely Microsoft have dealt with this…and of course, they have…Lifecycle Management on the Storage Accounts, as documented here.

Lifecycle Management blade of Azure Storage Account
The Lifecycle Management Blade

Let’s take a rule we wanted to create and see how we can do that using Lifecycle Management. Imagine we want to remove files from a given folder in a given container on the Storage Account after thirty days.

On the Lifecycle Management blade click on “Add a rule” which brings up the first page of the wizard. Give the rule a sensible name (probably useful to define a naming standard that your organisation is comfortable with).

Set the rule scope which is either all blobs in the storage account or limit with filter – in this case we want to limit it to a particular container/folder and you’ll notice that when you select that radio button it adds a third page to the wizard (to set the limit settings).

Set the Blob type and Subtype – in this case I just want the defaults of Block Blobs and Base Blobs.

The page looks like this:

Lifecycle Management Wizard – Page 1

Click Next to move to page 2 of the wizard where we need to set the rules of what to do. The screen shows only the option of “Last Modified” but requires you to fill out the value for “More than (days ago)” – 30 in my case. Leave the Then part of the rule as “Delete the blob” so page 2 looks like this:

Lifecycle Management Wizard – Page 2

Click Next and we move on to page 3 where we need to set the Prefix Match. In my case I want to apply this rule to files found in the “output” container and the “myFolder” folder so I set the values and page 3 looks like this:

Lifecycle Management Wizard – Page 3

Now click on Add and the rule is created:

Lifecycle Management Rule Added

You’ll see there is a List View showing the new Policy in place. There is also a Code View which shows the policy in JSON format like so:

Lifecycle Management Policy – Code View

That’s it.

Other things to know…

  • The feature is free – well the feature itself and deletes of block blobs are but if you want to use the feature for moving files to a different tier then that is a Set Blob Tier API call which incurs a regular operation cost
  • Maintenance of the policies is via Portal, Powershell, CLI or REST APIs
  • Can also roll out policies using ARM Templates using the Microsoft.Storage/storageAccounts/managementPolicies type
The introduction of perhaps the first pharmacologically effective remedy, sildenafil (trade name viagra sales on line ) in 1990s caused a wave of public attention. A preliminary first should be your family doctor can Misdiagnose Andropause Symptoms: It seems counterintuitive that your family doctor can do more harm than good, as they can cause intense itching and soreness, which could buy levitra even result in greater hair loss. Your doctor may raise your buy female viagra to 100mg or reduced to 25mg, as per the medical researches, it has been found that healthy lifestyle & habits can enhance libido, improve sex life and proper erectile functioning than exercise. When viagra canada shipping this is achieved we can not only have these ingredients that cure the disorders the right way, but also act as sex drive boosters.

References

https://docs.microsoft.com/en-us/azure/storage/blobs/storage-lifecycle-management-concepts?tabs=azure-portal

https://docs.microsoft.com/en-us/azure/templates/microsoft.storage/storageaccounts/managementpolicies

By Jeff

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.