Unable to delete Azure Recovery Services Vault
I had used Azure Recovery Services vault for backing up SQL Server databases on an Azure VM. After decommissioning the SQL Server databases and the Azure VM, I tried to delete the Recovery Services vault as I no longer needed it. However, I noticed I was not able to delete the Azure Recovery Services vault due to an error. Is there any way by which we can delete the Azure Recovery Services vault?
This tip assumes that you already have resources in your Azure environment and you are familiar with using the Azure portal. If you are new to Azure, you can subscribe to a trial account here, which will give you access to Azure services for a year and a credit of USD $200. If you are new to Azure Recovery Services vault, you may refer this tip which has step by step instructions on how to backup SQL Server databases.
In this tip, you will see how to perform restore of SQL Server databases using Recovery Services vault.
Error while deleting Recovery Services vault
In this tip, we will explore how to delete the Recovery Services vault if we no longer need it. I had already configured the Recovery Services vault to back up the SQL Server databases on an Azure VM. As I no longer needed the Azure VM, I deleted the Azure VM and then tried to delete the Recovery Services vault. For deleting the Recovery Services vault, follow this sequence of steps as shown in the screenshot.
Once you click on the 'Delete' option, you will get a screen asking you to confirm and then you will encounter this error message.
This is even after you delete the Azure VM for which you had configured the SQL database backups using the Recovery Services vault.
Steps to delete the Recovery Services vault
In order to delete the Recovery Services vault, you would need to stop the backup jobs and then unregister the VM from the backup infrastructure.
Steps to stop the backup jobs
In this tip, you would see the steps to perform the backups using the Recovery Services vault. Once the backups are running, backup jobs get created for the specified databases. You can check the backup jobs that are scheduled by clicking on the backup items as shown.
Click on the 'SQL in Azure VM' option. You can see a count of 7 which shows the number of backup jobs that were configured earlier for the SQL databases. These jobs don't get deleted even after the Azure VM is deleted.
In the screenshot, click on the ellipsis on the right-hand corner as shown for each of the backup items and select 'Stop backup'. Once you select the 'Stop backup' option, you will see this screen.
You can either select the option to 'Retain backup data' or 'Delete backup data'. The stop process takes few minutes to complete and you will see the confirmation that it has stopped on the notifications window. I used the 'Delete backup data' as the Azure VM used was only for test purposes.
You will notice that the backup job is stopped. Once the backup job shows as stopped, you will see this in the backup items section.
Here, you can see confirmation of the 'Protection stopped' for the database 'b'. Repeat this process of stopping the backup jobs for each of the databases in the list. You can clean up all the backup items by using the delete option in the ellipsis. Once, all the backup items are removed, you will see confirmation on the portal as shown.
You can see that backup item count is 0 and when you click on item count, you will see this screen.
Step to unregister the Azure VM from backup infrastructure
The next step would be to unregister the Azure VM from the backup infrastructure option.
Once you click on the 'Backup Infrastructure' option, you will see this screen.
Click on 'Workload in Azure VM' as shown and select the option to 'Unregister' the Azure VM.
Once you click on 'Unregister', you will need to provide the details of the Azure VM that you plan to delete.
Enter the name of the server, select a reason, enter comments and click on 'Delete'. The process to unregister will complete in few minutes and you will see the confirmation on the notification section.
You can also get the confirmation when you click on the 'Backup Infrastructure' section as shown.
Here, you can see the protected server count of the workload in Azure VM as 0.
Steps to delete the Recovery Services vault
After you have performed the above steps, you can go back to the option to delete the Recovery Services vault.
Once you click on 'Delete', you will get the page to confirm on the operation.
After you click on 'Yes', in a few seconds you will get confirmation that the Recovery Services vault is deleted.
- In this tip, you learned how Recovery Services vault can be deleted when it is no longer required
- In the demo, you saw how the backup items in the Recovery Services vault can be stopped
- In the demo, you saw how to unregister the Azure VM from the Backup Infrastructure option as shown
- You also saw a reference to an earlier tip on how to backup SQL Server databases using the Recovery Services vault
- You also saw a reference to an earlier tip on how to perform database restores using Recovery Services vault
- Recovery Services vault is a cool feature available in Azure and you can try out the steps by referencing the earlier tips and also this tip
- Try out this demo on your own Azure environment
- Refer other articles available on MSSQLTips related to Azure
Last Updated: 2020-03-26
About the author
View all my tips