问题
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.
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?
回答1:
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
来源:https://stackoverflow.com/questions/44404847/how-to-delete-azure-recovery-services-vault