This guide walks you through deleting snapshots of an Azure Blob Storage blob. Snapshots are read-only point-in-time copies that can accumulate storage costs, so cleaning them up is a common maintenance task. You’ll learn how to remove a single snapshot, all snapshots, or snapshots with a specific tag using the Azure portal, Azure CLI, and PowerShell.
What You’ll Need
- An Azure subscription with a storage account that contains blob snapshots.
- Appropriate permissions: either the Storage Blob Data Contributor role or the Storage Account Contributor role (or higher, like Owner) on the storage account.
- For Azure CLI: Azure CLI installed and logged in (
az login). - For PowerShell: Az PowerShell module installed and connected (
Connect-AzAccount).
Step-by-Step
Method 1: Using the Azure Portal
- Navigate to the Azure portal (portal.azure.com) and open your storage account.
- Under Data storage, select Containers.
- Click the container that holds the blob with snapshots.
- Find the blob you want to clean up. If it has snapshots, you’ll see a Snapshots count in the row.
- Click the ellipsis (…) at the end of the blob row, then select View snapshots. A list of snapshots appears.
- To delete a single snapshot, click the ellipsis next to that snapshot and choose Delete. Confirm the deletion.
- To delete all snapshots, go back to the blob list, click the ellipsis, and select Delete. In the confirmation dialog, check the box that says Include snapshots and then confirm. This deletes the blob and all its snapshots.
Method 2: Using Azure CLI
- Open a terminal (Command Prompt, PowerShell, or bash) and log in:
az login. - Set the storage account and container variables (replace placeholders):
storageAccount="yourstorageaccount" containerName="yourcontainer" blobName="yourblob.txt" - To list all snapshots of a blob:
az storage blob list --account-name $storageAccount --container-name $containerName --prefix $blobName --include snapshots --query "[?snapshot != null]" --output table - To delete a specific snapshot, use the
--snapshotparameter with the snapshot timestamp:az storage blob delete --account-name $storageAccount --container-name $containerName --name $blobName --snapshot "2025-04-01T12:00:00.0000000Z" - To delete all snapshots (but keep the base blob), you can loop through the snapshot list:
snapshots=$(az storage blob list --account-name $storageAccount --container-name $containerName --prefix $blobName --include snapshots --query "[?snapshot != null].snapshot" -o tsv) for snap in $snapshots; do az storage blob delete --account-name $storageAccount --container-name $containerName --name $blobName --snapshot $snap done - To delete the blob and all its snapshots in one command, use
--delete-snapshots include:az storage blob delete --account-name $storageAccount --container-name $containerName --name $blobName --delete-snapshots include
Method 3: Using PowerShell
- Open PowerShell and connect to Azure:
Connect-AzAccount. - Set the storage context:
$storageAccount = Get-AzStorageAccount -ResourceGroupName "yourResourceGroup" -Name "yourstorageaccount" $ctx = $storageAccount.Context - To list snapshots of a blob:
Get-AzStorageBlob -Context $ctx -Container "yourcontainer" -Blob "yourblob.txt" -IncludeSnapshot | Where-Object { $_.SnapshotTime -ne $null } | Select-Object Name, SnapshotTime - To delete a specific snapshot, pass the snapshot time:
$snapshotTime = [DateTimeOffset]::Parse("2025-04-01T12:00:00.0000000Z") Remove-AzStorageBlob -Context $ctx -Container "yourcontainer" -Blob "yourblob.txt" -SnapshotTime $snapshotTime - To delete all snapshots but keep the base blob, loop through the snapshot list:
$snapshots = Get-AzStorageBlob -Context $ctx -Container "yourcontainer" -Blob "yourblob.txt" -IncludeSnapshot | Where-Object { $_.SnapshotTime -ne $null } foreach ($snap in $snapshots) { Remove-AzStorageBlob -Context $ctx -Container "yourcontainer" -Blob $snap.Name -SnapshotTime $snap.SnapshotTime } - To delete the blob and all snapshots, use the
-DeleteSnapshotparameter:Remove-AzStorageBlob -Context $ctx -Container "yourcontainer" -Blob "yourblob.txt" -DeleteSnapshot Include
Common Mistakes
- Forgetting to include snapshots when deleting the base blob – If you delete a blob without specifying to include snapshots, the snapshots remain and continue to incur storage costs.
- Using the wrong snapshot timestamp format – Azure CLI and PowerShell expect the snapshot time in ISO 8601 format (e.g.,
2025-04-01T12:00:00.0000000Z). Using a different format can cause errors. - Not having the correct permissions – If you’re not assigned a role that allows blob deletion (like Storage Blob Data Contributor), the delete operation will fail with an authorization error.
- Deleting the base blob when you only wanted to delete snapshots – Double-check your command; using
--delete-snapshots includedeletes the base blob as well. If you only want to remove snapshots, use a loop or specify the snapshot explicitly.
Tips
- Use lifecycle management – Instead of manually deleting snapshots, you can set up a lifecycle management policy to automatically delete snapshots older than a certain age.
- Test on a non-critical blob first – Before running a bulk delete, test your command on a blob that you don’t mind losing to ensure the syntax is correct.
- Monitor storage costs – After deleting snapshots, check the storage account metrics to confirm that capacity usage drops.
- Use tags for selective deletion – If you need to delete only snapshots with a specific tag, you can list snapshots with tags and filter them in your script.
Troubleshooting
- Error: “AuthorizationPermissionMismatch” – This means your account lacks the required permission. Ask an administrator to assign you the Storage Blob Data Contributor role on the storage account.
- Error: “SnapshotNotFound” – The snapshot timestamp you provided does not exist. List snapshots again to get the exact timestamp.
- Snapshot deletion appears to succeed but snapshots still show – This can happen if you’re looking at a cached view. Refresh the portal or re-run the list command after a few seconds.
- Azure CLI says “–snapshot is not supported” – Ensure you’re using the latest version of the Azure CLI. Older versions may not support the parameter for all blob types.
- PowerShell cannot find the blob – Verify the container name and blob name are spelled correctly, and that the blob is not in a different storage account.
Frequently Asked Questions
Can I delete a snapshot without deleting the base blob?
Yes, you can delete individual snapshots by specifying the snapshot timestamp. The base blob remains untouched.
What happens to snapshots if I delete the base blob without including snapshots?
The snapshots remain and become orphaned. They are still accessible but you cannot create new snapshots from a deleted base blob. You can delete them separately.
Is there a way to delete all snapshots for all blobs in a container at once?
Yes, you can use a script that iterates over all blobs in the container and deletes their snapshots. For example, in PowerShell you can loop through Get-AzStorageBlob -Container "yourcontainer" -IncludeSnapshot and filter for snapshots.
Do snapshots count against my storage quota?
Yes, snapshots consume storage capacity. Each snapshot stores only the changes from the previous version, but they still occupy space and incur costs.
Can I delete snapshots using the Azure REST API?
Yes, you can call the Delete Blob REST API with the x-ms-delete-snapshots header set to include or only. This is useful for automation.
How long does it take for a snapshot deletion to complete?
Deletion is immediate in terms of logical removal, but the underlying storage space may be reclaimed asynchronously. You may see the snapshot disappear instantly from listings, but the capacity reduction may take a few minutes to reflect.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Mac Start Up Automatically After Power Failure?
- Expose Self-Hosted Service Securely Without Cloudflare Tunnel
- Nano Delivery for Functional Foods: What It Can and Can’t Do4.00
- Disable Apple Watch Turn-by-Turn Vibration While Driving
- Convert Play FLAC in iTunes: Full Guide
- Soda Foundation Charter: What It Means