Vault Cannot Be Deleted As There Are Existing Resources Within The Vault

Vault Cannot Be Deleted As There Are Existing Resources Within The Vault

In this Azure Article, we will discuss how to fix the error, ” Vault Cannot Be Deleted As There Are Existing Resources Within The Vault “. This error I got when I was trying to delete one of the Recovery Services vaults.

Vault Cannot Be Deleted As There Are Existing Resources Within The Vault

Recently, I was trying to clear the unused Azure resources to reduce the cost, When I tried to delete one of the Azure Recovery Services vaults, it didn’t allow me to delete and I got this error.

The complete error message was as below

Vault cannot be deleted as there are existing resources within the vault: Please ensure all containers have been unregistered from the vault and all private endpoints associated with the vault have been deleted, and retry the operation. For more details, see https://aka.ms/AB-AA4ecq5

I followed the below steps to delete the Azure Recovery Service vault. My Azure Recovery Service vault name was vault938 and I was trying to delete it.

To delete the Azure recovery services vault, Navigate to the Recovery Services vault, and click on the Recovery Services vault that you want to delete. On the Recovery Services vault page, click on the Delete button.

Vault Cannot Be Deleted As There Are Existing Resources Within The Vault

Then I clicked on the Yes button for the confirmation

Azure vault cannot be deleted

I got the below Vault deletion error as “Vault Cannot Be Deleted As There Are Existing Resources Within The Vault” as shown below.

Unable to delete Recovery Services Vault?/Can't delete Azure Backup Vault?

Now the reason I got this error is that there is a Backup item for the Azure Virtual Machine that is attached to this Recovery Services vault. To check that, click on the Backup items link under Protected items on the Recovery Services vault page.

Unable to delete Recovery Services Vault?

After clicking on the Backup items, you can see for the Azure Virtual Machine, the Backup Item count is 1. Click on the Azure Virtual Machine.

Azure recovery services vault soft delete

You can see below, this is the Virtual Machine backup instance that is attached to the Azure Recovery Services vault.

SOLVED! BACKUP VAULT ‘CANNOT BE DELETED’ ERROR IN AZURE RECOVERY SERVICES

Now to fix this error, what you need to do is, you need to delete the Backup Items(Azure Virtual Machine).

To delete this, select the Azure Virtual Machine backup instance, click on the three dots (…) or you can right-click on that for the same options and then click on the stop backup option.

Delete Vault Error Message: Vault cannot be deleted as there existing resources within the vault

Now click on the Stop Backup button to confirm the Stop Backup functionality.

Unable to delete azure recovery services vault

Now you can see the Stopping backup functionality completed successfully.

Receiving an Error when deleting an Azure Recovery Services Vault

Now after stopping the backup, select the Azure Virtual Machine backup instance, click on the three dots (…) or you can right-click on that for the same options and then click on the Delete backup data option

Vault cannot be deleted as there are existing resources within the vault – Azure

Type the name of the Backup item and then click on the Delete button to delete the Backup data.

Note: An important thing to note here is the name of the Backup Item is case sensitive and you need to enter exactly the same name of the Backup Data as it is.

How to delete azure backup vault

You can see below it deleted the backup data for the virtual machine successfully.

azure vault cannot be deleted as there are existing resources within the vault

See here, The restore points for this backup item have been deleted and retained in the soft delete state and will be available for 13 more days to recover. After which they will be permanently deleted. That means even though you deleted the Backup data but it is available still for 13 more days in a soft delete state then after it will delete permanently.

deleting a recovery services vault

You can see below the Backup items (Azure Virtual Machine) is in a Soft delete state.

force delete recovery services vault

Now again if you will try to delete the Azure Recovery Services vault, it will not allow you to delete and you will get the below error

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

Vault Cannot Be Deleted As There Are Existing Resources Within The Vault [Solution]

So now you have two options to delete the Azure Recovery Services vault to fix the error “Vault Cannot Be Deleted As There Are Existing Resources Within The Vault”

Option-1: You need to wait for 14 days and then after it will completely deletes the soft delete backup data automatically, after that, you can try deleting the Azure Recovery Services vault, it will allow you to delete this time without any issue.

Option-2: If you want to permanently delete the soft delete data immediately instead of waiting for 14 days, then you need to follow the below steps to do that. Then you can able to delete the Azure Recovery Services vault immediately without any issue.

The first step is to disable the Soft delete option in the Azure Portal, to do that. Click on the Properties under the settings option on the Recovery Services vault page and then click on the Security Settings —> Update link.

disable soft delete azure key vault

On the Security Settings page, Select the Disabled button for the Soft Delete (For Azure Virtual Machines) option and then click on the Save button to update the changes.

As mentioned below, you can see once you disabled the Soft delete option, all future deletes will be immediate and will not have soft delete protection.

how to disable soft delete azure key vault

Now the settings are updated.

azure soft delete option disable

Now the Soft Delete (For Azure Virtual Machines) option is disabled so now on the next step, select the Soft Delete backup data and click on the three dots (…), click on the Undelete option.

Azure soft delete disable

Click on the Undelete button to confirm the undelete functionality.

soft delete azure vm

Now if you will try deleting the backup data, you can able to delete the backup data without any issue.

disable soft delete azure backup

Just to verify, you can see below, the backup data is deleted successfully.

how to disable soft delete azure backup

Since there is no backup data present for the Azure Virtual Machine, so now if you try deleting the Azure Recovery Services vault, you can able to delete it without any issue.

Azure turn off soft delete

Click on the Yes button to confirm the Deletion process

Azure turn off soft delete option

You can see below the Recovery Services vault was successfully deleted without any issue.

azure backup disable soft delete

Just to reconfirm you can see below there is no Recovery services vault present.

recovery services vault disable soft delete

This is how we can fix the error “Vault Cannot Be Deleted As There Are Existing Resources Within The Vault” and This is how we can delete Azure recovery services vault using the Azure Portal.

You may also like going through the below tutorials

Conclusion

Well, in this tutorial, we discussed how to fix the error “Vault Cannot Be Deleted As There Are Existing Resources Within The Vault”.