Azure Blob Storage Immutability Policies

Azure Blob Storage immutability policies allow you to store business-critical data in a write-once, read-many (WORM) state. This feature provides protection against accidental or malicious deletion and modification of data by ensuring that data cannot be modified or deleted for a specified retention period.

Key Concepts

Types of Immutability

Time-based Retention Policies

With time-based retention, you can configure a container to be immutable for a specific duration. Once set, the retention period cannot be shortened. It can only be extended.

Legal Holds

Legal holds are primarily used for compliance and litigation purposes. They allow you to preserve data indefinitely until the hold is explicitly removed, regardless of any retention policies.

Creating and Managing Immutability Policies

Using Azure Portal

You can configure immutability policies through the Azure portal when creating or managing a blob container. Navigate to your storage account, then to Containers, select your container, and under "Immutability policies," you can set up a time-based retention policy or add a legal hold.

Using Azure CLI

The Azure CLI provides commands to manage immutability policies. Here's an example of how to set a time-based retention policy on a container:

Setting a time-based retention policy Azure CLI

az storage container immutability-policy set \
    --account-name mystorageaccount \
    --container-name mycontainer \
    --retention-days 30 \
    --policy-mode Locked
        

To apply a legal hold:

Applying a legal hold Azure CLI

az storage container legal-hold create \
    --account-name mystorageaccount \
    --container-name mycontainer \
    --tags "litigation-id=abc123"
        

Using Azure SDKs

Azure SDKs for various programming languages (e.g., Python, .NET, Java) also support the management of immutability policies.

Important Note: Once a time-based retention policy is set to Locked mode, it cannot be deleted or modified. The retention period can only be extended. For legal holds, they can be added and removed as needed.

Use Cases

Considerations

Azure Blob Storage Overview Blob Versioning Lifecycle Management