Delete an Azure Backup Recovery Services vault

This article describes how to delete an Azure Backup Recovery Services vault. It contains instructions for removing dependencies and then deleting a vault.

Before you start

You can't delete a Recovery Services vault with any of the following dependencies:

  • You can't delete a vault that contains protected data sources (for example, IaaS VMs, SQL databases, Azure file shares).
  • You can't delete a vault that contains backup data. Once backup data is deleted, it will go into the soft deleted state.
  • You can't delete a vault that contains backup data in the soft deleted state.
  • You can't delete a vault that has registered storage accounts.

If you try to delete the vault without removing the dependencies, you'll encounter one of the following error messages:

  • Vault cannot be deleted as there are existing resources within the vault. Please ensure there are no backup items, protected servers, or backup management servers associated with this vault. Unregister the following containers associated with this vault before proceeding for deletion.

  • Recovery Services vault cannot be deleted as there are backup items in soft deleted state in the vault. The soft deleted items are permanently deleted after 14 days of delete operation. Please try vault deletion after the backup items are permanently deleted and there is no item in soft deleted state left in the vault. For more information, see Soft delete for Azure Backup.

Note

Before deleting a Backup protection policy from a vault, you must ensure that

  • the policy doesn't have any associated Backup items.
  • each associated item is associated with some other policy.

Delete a Recovery Services vault

Choose a client:

Delete the Recovery Services vault using Azure Resource Manager is recommended only if all of the dependencies are removed and you're still getting the Vault deletion error. Try any or all of the following tips:

  • From the Essentials pane in the vault menu, verify that there aren't any backup items, backup management servers, or replicated items listed. If there are backup items, refer to the Before you start section.
  • Try deleting the vault from the portal again.
  • If all of the dependencies are removed and you're still getting the Vault deletion error, use the ARMClient tool to perform the following steps (after the note).
  1. Go to chocolatey.org to download and install Chocolatey. Then, install ARMClient by running the following command:

    choco install armclient --source=https://chocolatey.org/api/v2/

  2. Sign in to your Azure account, and then run the following command:

    ARMClient.exe login [environment name]

  3. In the Azure portal, gather the subscription ID and resource group name for the vault you want to delete.

For more information on the ARMClient command, see ARMClient README.

Use the Azure Resource Manager client to delete a Recovery Services vault

  1. Run the following command by using your subscription ID, resource group name, and vault name. If you don't have any dependencies, the vault is deleted when you run the following command:

    ARMClient.exe delete /subscriptions/<subscriptionID>/resourceGroups/<resourcegroupname>/providers/Microsoft.RecoveryServices/vaults/<Recovery Services vault name>?api-version=2015-03-15
    
  2. If the vault isn't empty, you'll receive the following error message: Vault cannot be deleted as there are existing resources within this vault. To remove a protected item or container within a vault, run the following command:

    ARMClient.exe delete /subscriptions/<subscriptionID>/resourceGroups/<resourcegroupname>/providers/Microsoft.RecoveryServices/vaults/<Recovery Services vault name>/registeredIdentities/<container name>?api-version=2016-06-01
    
  3. In the Azure portal, make sure that the vault is deleted.

Next steps