adbertram / AzureVmSnapshots

A small PowerShell module to automate creating and restoring Azure VM snapshots
12 stars 6 forks source link

Remove-AzVmSnapshot not deleting the snapshot #1

Open asote opened 5 years ago

asote commented 5 years ago

Executed the following command: Get-AzVmSnapshot -ResourceGroupName A-RG -VmName vmA | Remove-AzVmSnapshot

Confirm Are you sure you want to perform this action? Performing the operation "Remove [AzVmSnapshot-vmA-20190801090806]" on target "Snapshot". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Y

Name : StartTime : 8/1/2019 9:26:57 AM EndTime : 8/1/2019 9:26:57 AM Status : Succeeded Error :

But the snapshot is still displayed in the Azure Portal\Snapshots. Had to delete it manually.

adbertram commented 5 years ago

That's an odd one. It uses Remove-AzDisk to remove the disk. From the output you received, that comes directly from that command. If this happens again, try to run this command manually and see if it's removed.

Remove-AzDisk -ResourceGroupName A-RG -DiskName <snapshotnamehere> -Force

AO-TERRA commented 4 years ago

@adbertram I am having the same issue, I used the command you mentioned but it also did not remove the snapshot

neonatus1 commented 3 years ago

I am experiencing the same issue. Running the command Remove-AzDisk manually gives the same output as the remove-azvmsnapshot command, but neither seems to actually delete the snapshot itself.

It seems it is necessary to run RemoveAzSnapshot commandlet to actually remove the snapshot. Remove-AzSnapshot -ResourceGroupName $RG.Name -SnapshotName $SS.Name -Force

seems to do it correctly for me.

Kind regards, Boštjan