Skip navigation
Delete a Blob snapshot in Azure

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()
} 

 

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish