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.
Delete a Blob snapshot with PowerShell.
August 13, 2016
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()}
You May Also Like