Home > Tech Tips > Deleting an Azure Recovery Services Vault
Microsoft Azure

Deleting an Azure Recovery Services Vault

First let me tell you what a nightmare this was. So I was on a free trial to study for the Azure Administrator Associate and wanted to continue with the free services so I added my credit card to the account and as I was coming to the end of the free trial I tried every which way to delete the recovery services vaults but wasn’t able to via PowerShell or the Azure Portal as there was backup’s in the vault.

I stopped the backups, but still couldn’t delete the vaults. Waiting for 14 days, which is the retention period to go by and staring at the charges as they increased on my personal credit card wasn’t an option.

In their documentation, there’s instructions for using the ARMClient so I went and installed chocolatey. Then installed the ARMClient to try and delete them again.

First, I had to login to Azure:

armclient.exe login Prod

After logging in, I went in for the kill. (I replaced my subscription id with <subscriptionId>)

ARMClient.exe delete /subscriptions/<subscriptionId>/resourceGroups/WorkstationBackup/providers/Microsoft.RecoveryServices/vaults/MyWorkstations?api-version=2015-03-15

Azure Resource Manager fired back with a “YOU SHALL NOT PASS!”

{
  "error": {
    "code": "ServiceResourceNotEmptyWithContainerDetails",
    "message": "Vault cannot be deleted as there are existing resources within the vault. : DEVWKS03-VH.\nUnregister all containers from the vault and then retry to delete vault. For instructions, see https://aka.ms/AB-AA4ecq5",
    "target": null,
    "details": null,
    "innerError": null
}

AH HA!! The enemy has just revealed where this mystical, fleeting, gypsy-like container is hiding… WITCHCRAFT!

So I ran the following command to remove the container.

ARMClient.exe delete /subscriptions/<subscriptionId>/resourceGroups/WorkstationBackup/providers/Microsoft.RecoveryServices/vaults/MyWorkstations/registeredIdentities/DEVWKS03-VH.?api-version=2016-06-01 

That worked for that vault. Immediately after that I was able to delete the vault. However, I have another vault which I couldn’t delete which was protecting an Azure VM. For that vault, I opened a support ticket.