How to delete Azure Recovery Services vault?

こ雲淡風輕ζ 提交于 2019-12-01 10:22:19

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!