1
votes

When I am trying to delete the Azure Recovery Services Vault from Azure portal, I got the error like in below figure. Even I deleted all backup items and replicated items from the vault.

enter image description here

For deleting the Azure Recovery Services vault, I have followed the below link

Delete an Azure Backup vault

So, how to delete the Azure recovery Services vault using portal or power shell cmdlet?

2
Maybe you could check this answer.Shui shengbao
Do you backup SQL on you key vault?Shui shengbao
Yes. I backup SQL on my recovery service vault.Pradeep
It does not appear on vault, you also need to delete it. Please check my answer.Shui shengbao

2 Answers

4
votes

I used to encounter the same problem, there are SQL backups in the vault. You need find SQL backups and delete them.

You could check this answer to solve this issue.

$vault = Get-AzureRmRecoveryServicesVault -Name "VaultName"

Set-AzureRmRecoveryServicesVaultContext -Vault $vault

#VIEW THE BACKUP ITEMS
$container = Get-AzureRmRecoveryServicesBackupContainer -ContainerType AzureSQL -FriendlyName $vault.Name

$item = Get-AzureRmRecoveryServicesBackupItem -Container $container -WorkloadType AzureSQLDatabase

$availableBackups = Get-AzureRmRecoveryServicesBackupRecoveryPoint -Item $item

$availableBackups      
#REMOVE THE BACKUP ITEMS AND VAULT
$containers = Get-AzureRmRecoveryServicesBackupContainer -ContainerType AzureSQL -FriendlyName $vault.Name

ForEach ($container in $containers)
{
    $items = Get-AzureRmRecoveryServicesBackupItem -container $container -WorkloadType AzureSQLDatabase

    ForEach ($item in $items)
    {
        Disable-AzureRmRecoveryServicesBackupProtection -item $item -RemoveRecoveryPoints -ea SilentlyContinue
    }

    Unregister-AzureRmRecoveryServicesBackupContainer -Container $container
}

Remove-AzureRmRecoveryServicesVault -Vault $vault
1
votes

If you have soft delete enabled you normally have to wait 14 or so days. Switch off soft delete in the storage vault then either undelete and redelete a VM then you can delete the vault