TIP

🔥 The FREE Azure Developer Guide eBook is available here (opens new window).

💡 Learn more : Azure Blob Storage overview (opens new window).

📺 Watch the video : How to automatically manage Azure Blobs lifecycles (opens new window).

# How to automatically manage Azure Blobs lifecycles

# Azure Blob Storage access tiers

In Azure Blob Storage (opens new window), you pay for the storage that blobs take up and the tier that they are stored in. For instance, blobs that are stored in the Hot tier (opens new window) are the most expensive and can be accessed directly. And blobs in the Archive tier (opens new window) are the least expensive and take a while to be accessed. This tiered system is great and works well when you actively move your blobs to the appropriate tiers. Azure Blob Lifecycle management (opens new window) makes this easier by automatically moving blobs or deleting them based on rules.

In this post, we'll configure an Azure Blob Storage Lifecycle management rule in the Azure portal.

# Prerequisites

If you want to follow along, you'll need the following:

# Create a Blob Lifecycle management rule

Let's create a rule for Azure Blobs to move to the Cool storage access tier when they aren't modified for 20 days.

  1. Go to the Azure portal (opens new window)
  2. Navigate to the Azure Storage account
  3. In the Blob service section of the menu, select Lifecycle management

(Lifecycle management menu in the Azure portal)

  1. Create a new rule by clicking on the Add rule button
  2. In the Details tab:
    1. Put in a name for the rule
    2. Select Limit blobs with filters
    3. Select Base blobs for Blob subtype
    4. Select Next

(Create a Lifecycle rule, details tab in the Azure portal)

  1. On the Base blobs tab:
    1. Put "20" in the More than (days ago) field
    2. Select Move to cool storage
    3. Select Next

(Create a Lifecycle rule, base blobs tab in the Azure portal)

  1. In the Filter set tab, put in \logs to indicate that this rule only applies to the "logs" container

(Create a Lifecycle rule, filter set tab in the Azure portal)

  1. Select Add to create the rule

Now, all blobs in the logs container that aren't modified for 20 days, will automatically be moved to cool storage.

(Lifecycle management rule in the Azure portal)

# Conclusion

Azure Blob Storage (opens new window) access tiers (opens new window) are great to reduce your storage costs. And now, with Azure Blob Storage Lifecycle management (opens new window), you can automatically move blobs to their appropriate access tier, based on their usage. Go and check it out!