Unable to delete Azure Blob container due to ContainerImmutableStorageWithVersioningEnabled error

Jose Blanco 0 Reputation points
2025-10-10T14:08:53.8533333+00:00

Hello,

I’m trying to delete an Azure Blob container that was previously used for backups in a test/non-production environment, but I’m getting this error:

"The requested operation is not allowed as the container has a immutable storage with versioning enabled. ErrorCode: ContainerImmutableStorageWithVersioningEnabled"

What I’ve checked so far:

  • az storage container immutability-policy show → returns nothing (no active policy)
  • az storage container legal-hold showhasLegalHold: false
  • Container exists and is accessible

Despite no active immutability policy or legal hold, deletion fails due to immutable storage with versioning enabled.

Question: How can I remove this immutable configuration or request a manual override so I can delete the container and clean up the storage account?

Thank you!

Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Michele Ariis 6,255 Reputation points MVP
    2025-10-10T14:27:55.7266667+00:00

    Hi, this is expected: when version-level immutability is enabled, the container can’t be deleted while there’s any blob version or snapshot remaining, even if there’s no active container-level policy or legal hold. Fix: check and remove (if unlocked) any blob-level immutability policies using az storage blob immutability-policy show|delete -n <blob> --version-id <id>, then delete all snapshots (az storage blob delete-batch -s <container> --delete-snapshots include), and remove all blob versions listed via az storage blob list --include v by calling az storage blob delete --version-id <id> for each. If any version has a locked retention, you must wait until it expires. Once no blobs or versions remain, az storage container delete -n <container> will succeed (same applies if you want to delete the entire storage account).

    0 comments No comments

  2. Priya ranjan Jena 1,510 Reputation points Microsoft External Staff Moderator
    2025-10-10T15:35:51.7433333+00:00

    Hi Jose Blanco,

    Thank you for reaching out on Microsoft Q&A forum

    Immutable Storage with Versioning is a compliance feature. Once enabled, the container cannot be deleted until:

    • All blobs and versions are removed.
    • Any retention period or legal hold has expired.

    The error persists because the container is flagged as immutable at the account or container or blob level, even if no explicit policy is shown via CLI. This happens when version-level immutability support was enabled during creation.To check all blob level versions and immutability policies

    az storage blob list --account-name <StorageAccountName> --container-name <ContainerName> --include v
    
    
    

    Then check each blob for immutability:

    az storage blob show --account-name <StorageAccountName> --container-name <ContainerName> --name <BlobName> --query "immutabilityPolicy"
    
    
    

    To remove immutability config or override is possible only if the policy is unlocked, otherwise there is no manual override, you must wait for the retention period to expire.

    If policy is unlocked you can try below script:

    az storage blob immutability-policy delete \
      --account-name <StorageAccountName> \
      --container-name <ContainerName> \
      --name <BlobName>
    
    
    

    Repeat above for all blobs.

    To understand precisely about immutable blob storage config, please refer the link below

    https://free.blessedness.top/en-us/azure/storage/blobs/immutable-storage-overview

    Hope you find this comment helpful, if yes, please “up-vote” for the information provided , this can be beneficial to community members.

    Kindly let us know if you have any questions.

    Thanks

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.