Hi Biswas Shilpa (SEIT),
Thank you for your question
The issue you're facing stems from how Azure Blob Storage enforces immutability policies, even when the container is in an "Unlocked" state.
your container's immutability policy is in the "Unlocked" state, Azure still enforces the policy on any blob created. Here's what that means:
When a new blob is uploaded to a container with a time-based immutability policy, it becomes immutable immediately upon creation.
If the upload process includes multiple stages (such as creating the blob, writing data, and setting metadata), and any of these steps attempt to modify the blob after its creation, Azure will block it with an error.
ErrorCode: BlobImmutableDueToPolicy
This is likely the issue with the "az sql db" export, as it may be facing challenges due to the immutability policy.
1.Create the blob.
2.Attempt to write or update metadata or properties.
3.Get blocked because the blob is now immutable.
The container's immutability policy is currently "Unlocked," which allows you to change or delete the policy, however, blobs that have already been written remain immutable. When the policy is "Locked," it cannot be changed or removed until the retention period expires. So, "Unlocked" doesn't mean blobs can be written to. It just means the policy itself can be changed.
here, are some steps to solve:
The container's immutability policy is currently "Unlocked," which allows you to change or delete the policy, however, blobs that have already been written remain immutable. When the policy is "Locked," it cannot be changed or removed until the retention period expires. So, "Unlocked" doesn't mean blobs can be written to. It just means the policy itself can be changed.
Here, are some steps to solve:
consider using a staging container:
- Upload
.bacpac
files to a separate container where immutability is not enabled.
- After the upload finishes, copy the blob to the immutable container using
Start-Copy
or az storage blob copy start
.
Use version-level immutability if it is supported. 1.Version-level immutability enables creating new blob versions while keeping earlier versions immutable. 2.However, this might not be effective if the export tool attempts to modify the blob after it has been created.
Consider temporarily removing the immutability policy:
If your process involves writing metadata or modifying the blob, you can:
- Remove the immutability policy before the upload,
- Then reapply the policy after the upload is complete.
- This can only be done while the policy is in the unlocked state.
Reference:
I hope this information helps. Please do let us know if you have any further queries.
Please do not forget to “up-vote” wherever the information provided helps you, this can be beneficial to other community members.