Hi @Lukáš Vaško,
Thank you for confirming and for sharing the exact CLI error, this behavior is expected and aligns with how version-level immutability (ImmutableStorageWithVersioning) works in Azure Blob Storage.
Although the immutability policy was unlocked and deleted, the key point is that:
This is explicitly documented by Microsoft:
“Version-level immutability cannot be disabled after it is enabled on the storage account, although unlocked policies can be deleted.”
Because of this:
The storage account still has ImmutableStorageWithVersioning enabled
Azure blocks deletion of containers that are not empty
“Not empty” includes:
- Current blobs
- All blob versions
- Snapshots (if any)
That is why the following command fails:
az storage container-rm delete --name <container> --storage-account <account>
with:
(ContainerProtectedFromDeletion)
The storage account container is protected from deletion due to ImmutableStorageWithVersioning
Azure enforces this protection before container deletion, regardless of whether an immutability policy currently exists.
To delete the storage account, the following sequence is required:
1.Delete all blobs from each container
- This must include all blob versions, not just the latest version
- If versioning was enabled, older versions continue to exist and block deletion
2.Delete the containers
- Once a container has zero blobs, versions, and snapshots, container deletion will succeed
3.Delete the storage account
This requirement is also documented:
Refer: Configure immutability policies for blob versions
Kindly let us know if the above helps or you need further assistance on this issue.
If the answer is helpful, please "Accept the answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".