Delete a Blob snapshot in Azure

Delete a Blob snapshot with PowerShell.

John Savill

August 13, 2016

1 Min Read
Delete a Blob snapshot in Azure

Q. How can I delete Blob snapshots in an Azure Storage Account?

A. The PowerShell below finds all snapshots for a specific blob name and then enumerates the snapshots and deletes them all. You could change this to match your own requirements.

#Define variables for the storage context ($AzStrCtx), the container ($Container) and blob name ($VHDName)$VMsnaps = Get-AzureStorageBlob –Context $AzStrCtx -Container $Container | Where-Object {$_.ICloudBlob.IsSnapshot -and $_.Name -eq $VHDName -and $_.SnapshotTime -ne $null } foreach($VMSnap in $VMsnaps){    $VMSnap.ICloudBlob.Delete()} 

 

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like