none
Cannot delete Recovery Services vault

    Question

  • Hi, 

    I have got an empty Recovery Services vault (not items there) which I cannot delete. It was used for Azure SQL Database backup. The SQL Server was also deleted.

    I am getting this error:

    Vault cannot be deleted as there are existing resources within the vault. Please delete any replicated items, registered servers, Hyper-V sites (Used for Site Recovery), policy associations for System Center VMM clouds (Used for Site Recovery) and then delete the vault.

    I tried to check also additional resources through https://resources.azure.com but there are no any additional items in my Recovery Services vault.

    How can I delete it?

    Thanks

    Monday, December 12, 2016 12:12 PM

Answers

  • You may try - The PowerShell cmdlet to delete a recovery vault is “Remove-AzureRmRecoveryServicesVault -Vault <Vault-Object>”. To get the vault object using Get-AzureRmRecoveryServicesVault.

    Users must exercise due caution while using the “Remove-AzureRmRecoveryServicesVault” cmdlet as this will delete the vault irrespective of the contents of the vault. So if there are replicating machines or backed up machines etc. in the vault, these will be lost. Additionally if there were on-premises assets that were registered to the vault, these would need to be manually cleaned up because clean up cannot be triggered from the vault once it has been deleted.

    Regards,

    Sadiqh

    Sunday, December 18, 2016 10:58 AM
    Moderator

All replies

  • Hi,

    Thank you for contacting us!

    Please follow the steps in the article below to delete the recovery services vault.

    https://docs.microsoft.com/en-us/azure/backup/backup-azure-delete-vault

    Hope that helps!

    Best Regards

    Sadiqh Ahmed
    ________________________________________________________________________________________________

    If this post was helpful to you, please up vote it and/or mark it as an answer so others can more easily find it in the future

    Tuesday, December 13, 2016 5:57 AM
    Moderator
  • Dear Sadiqh,

    Thank you for your reply. Actually, I forgot to mention that I followed those steps already. See the screen shot, there are ZEROs everewhere.

    What would be the further steps?

    Regards, Vaclav.


    

    Tuesday, December 13, 2016 9:48 AM
  • Can you check if there are any Replication or Backup Policies configured?

    Wednesday, December 14, 2016 10:45 AM
    Moderator
  • Sure. Please, see the attached images. I don't think there are any policies.

    Is there any PowerShell script I could run which would display all dependencies?

    Any other options?


    Wednesday, December 14, 2016 2:33 PM
  • You may try - The PowerShell cmdlet to delete a recovery vault is “Remove-AzureRmRecoveryServicesVault -Vault <Vault-Object>”. To get the vault object using Get-AzureRmRecoveryServicesVault.

    Users must exercise due caution while using the “Remove-AzureRmRecoveryServicesVault” cmdlet as this will delete the vault irrespective of the contents of the vault. So if there are replicating machines or backed up machines etc. in the vault, these will be lost. Additionally if there were on-premises assets that were registered to the vault, these would need to be manually cleaned up because clean up cannot be triggered from the vault once it has been deleted.

    Regards,

    Sadiqh

    Sunday, December 18, 2016 10:58 AM
    Moderator
  • Thank you Sadiqh, I will investigate this and update accordingly.

    Sincerely, Vaclav.

    Monday, December 19, 2016 9:33 AM
  • Did you find a solution to this?  I have the exact same issue.  SQL backup archive, but SQL instance now deleted. Everything is zero.  I have also tried the Powershell. :-(
    Tuesday, February 14, 2017 9:01 AM
  • @Robert J Head, reach out to Azure Support by using the URL at  http://aka.ms/getazuresupport.
    Tuesday, February 14, 2017 5:05 PM
    Moderator
  • Thanks for your reply.  Unfortunately that is something I will have to pay for as I don't have a support contract.  I'm not going to pay to get this fixed, I'll just live with it.  Any other suggestions most welcome.  Thanks again.
    Tuesday, February 14, 2017 8:56 PM
  • I have the same problem with a recovery-service-vault that can't be deleted. If I use the Powershell Command to delete the vault I get the following error:

      Remove-AzureRmRecoveryServicesVault : Operation Failed.
      ErrorCode: ServiceResourceNotEmpty
      Message: Vault cannot be deleted as there are existing resources within the vault.

    But as Sadiqh mentioned, the vault should also be deleted if it is not empty. Any advice and suggestions will be greatly appreciated.


    Wednesday, March 01, 2017 9:57 AM
  • This problem seems to come from setting up long term retention on an SQL server (one of that causes anyway).

    In order to remove the recovery vault(s), assuming they are already completely empty I was able to use the following Powershell script:


    Login-AzureRmAccount
    
    $vault = Get-AzureRmRecoveryServicesVault -Name <vaultname>
    Set-AzureRmRecoveryServicesVaultContext -Vault $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

    Hope this helps.  Again make sure the vault is completely empty and you have retrieved all data you wish to keep.

    Wednesday, May 10, 2017 12:12 PM
  • Thanks for sharing this information. This would be helpful to other community members.
    Thursday, May 11, 2017 1:36 AM
    Moderator
  • This solution has worked perfectly for me! Thanks!

    Felipe de Assis MCITP SQL Server 05/08: Database Administrator

    Tuesday, July 04, 2017 12:34 AM