Powershell scripts that might be useful when using azure backup
When user try to delete the File Share Snapshots that are created and leased by Recovery Service Vault, it is failed due to lease to RSV.
https://docs.microsoft.com/en-us/azure/backup/azure-file-share-backup-overview#how-lease-snapshot-works
The snapshots created by RSV shows its Initator as AzureBackup. In that case, user cannot delete the snapshot manually via Azure Portal. Below script is for deleting snapshots created and leased by RSV.
.\BreakLeaseAndDeleteSingleMabSnaphot.ps1 -ResourceGroupName RGName -StorageAccountName SAName -FileShareName FSName -SubscriptionId SubsID -SnapshotName SnapshotName -DeleteSnapshot $true
ex) .\BreakLeaseAndDeleteSingleMabSnaphot.ps1 -ResourceGroupName ComputeRG -StorageAccountName shystorageaccount1 -FileShareName fileshareorigin -SubscriptionId d72205c8-690d-45e5-961f-e8ac0d2cb9a3 -SnapshotName 2022-03-31T08:03:26.0000000Z -DeleteSnapshot $true
Same purpose and usage as BreakLeaseAndDeleteSingleMabSnapshots.ps
.\BreakLeaseAndDeleteMultipleMabSnaphot.ps1 -ResourceGroupName RGName -StorageAccountName SAName -FileShareName fileshareorigin -SubscriptionId SubsID -SnapshotName SnapshotName, SnapshotName -DeleteSnapshot $true
ex) .\BreakLeaseAndDeleteMultipleMabSnaphot.ps1 -ResourceGroupName ComputeRG -StorageAccountName shystorageaccount1 -FileShareName fileshareorigin -SubscriptionId d72205c8-690d-45e5-961f-e8ac0d2cb9a3 -SnapshotName "2022-03-31T08:03:26.0000000Z", "2022-03-31T08:03:44.0000000Z" -DeleteSnapshot $true