Azure Storage billing for deleted containers

Thomas Mueller 20 Reputation points
2025-01-13T08:17:02.04+00:00

This question is related "Azure Storage billing for deleted blobs" but with a twist.

I have Azure Blob Storage with "Blob soft delete" enabled for 14 days. However, "Container soft delete" is disabled. Now I have a use case where I need to retain many large blobs (up to 300 GB) for a short time, that is quite exactly 6 hours. This amounts to quite a sum. For this use case I do not need "blob soft delete" (it would be completely useless). But "blob soft delete" is for the whole account. It can not be disabled for some containers only, so I'm a bit stuck.

The idea I have is, for this use case, to alternate between two containers, the A container and the B container.

  • When new data is stored, store them in the A container, and delete the B container.
  • The next time (after 6 hours), store them in the B container, and delete the A container.
  • Repeat. So each 6 hours, create a new container, and delete the old one.

My question is: would deleting the container have the same cost as just deleting the blobs? Removing the blobs will keep them "soft deleted", so the storage cost is for 14 days. Removing the container (it can not be restored), according to my logic, should reduce the cost by a factor of 56 (14 times 4, because we have 14 days soft delete, and 4 times a day).

Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
3,118 questions
{count} votes

Accepted answer
  1. Nandamuri Pranay Teja 1,280 Reputation points Microsoft External Staff
    2025-01-13T09:29:43.36+00:00

    Hello Thomas Mueller,

    Welcome to Microsoft Q&A Forum. Thanks for posting your query here!

    I understand that you would like to know if deleting the container have the same cost as just deleting the blobs

    Please be informed that deleting a container in Azure Blob Storage that has "Container soft delete" disabled will result in the permanent deletion of the container and its contents, meaning you will not incur storage costs for the deleted container or its blobs after deletion.

    However, if "Blob soft delete" is enabled for your account, the blobs will remain in a soft-deleted state for the duration of the retention period (14 days in your case), which means you will still incur storage costs for those soft-deleted blobs during that time.

    In your scenario, if you delete a container, you will not have to pay for the storage of that container anymore, but you will still incur costs for the soft-deleted blobs for the retention period. Therefore, while deleting the container may reduce costs associated with the container itself, the costs for the blobs will still apply until the retention period expires.

    We recommend you adhere to the steps outlined below to refined solution and considerations:

    1. Upload your large blobs to Container A.
    2. After 6 hours Delete all blobs from Container A. Use the Azure CLI, PowerShell, or the Azure Storage SDK to efficiently delete all blobs within the container.
    3. Switch container to B and Start uploading new blobs to Container B.
    4. After 6 Hours (in Container B) Delete all blobs from Container B and Switch back to Container A.

    You can also Create an Azure Function triggered by a timer (e.g., every 6 hours) to automate the deletion process. This provides a reliable and scalable solution and alternatively, use Azure Logic Apps to orchestrate the container switching and deletion process.

    Answer for your question

    Yes, deleting the container will result in significant cost savings compared to simply deleting the individual blobs, especially with a 14-day soft delete period. This is because you immediately reclaim the storage space and eliminate the costs associated with storing soft-deleted blobs for those 14 days. During this period, you are still charged for the storage space occupied by these soft-deleted blobs. Deleting the container permanently removes all blobs within it, including those in the soft-deleted state. This immediately frees up the storage space and eliminates the associated storage costs for those 14 days.

    While the exact cost savings will vary based on your storage account type, usage patterns, and pricing tier, deleting the container generally results in substantial cost savings. You immediately reclaim the storage space consumed by the deleted blobs and their soft-deleted copies, avoiding those costs for the entire soft delete period.

    Additional information: Documentation on Soft delete for Blob storage - Pricing and billing :

    https://learn.microsoft.com/en-us/azure/storage/blobs/soft-delete-blob-overview#pricing-and-billing

    Please let us know you have any further quires. We are here at your service and will be glad to assist you closely.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

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