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).
Unable to delete Azure Blob container due to ContainerImmutableStorageWithVersioningEnabled error
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 show→hasLegalHold: 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
2 answers
Sort by: Most helpful
-
-
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 vThen 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