Remove recovery service vault completely from azure vm using PowerShell

Shekar Yenagandula 116 Reputation points
2023-01-18T19:31:28.9866667+00:00

Tried all the solutions. Tried using Disable-AzRecoveryServiceBackupProtection but kys just deleting the back up data. I want to remove(not delete) rsv from VM so that I can assign new rsv

Azure Backup
Azure Backup
An Azure backup service that provides built-in management at scale.
1,125 questions
Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,124 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Tasadduq Burney 8,361 Reputation points MVP
    2023-01-18T21:31:15.02+00:00

    To remove a Recovery Service vault completely from an Azure VM using PowerShell, you can use the following steps:

    Connect-AzAccount
    Stop-AzRecoveryServicesBackupJob -Name "MyVM"
    Remove-AzRecoveryServicesBackupItem -Name "MyVM"
    Remove-AzRecoveryServicesVault -Name "MyRSVault"
    

  2. KarishmaTiwari-MSFT 18,367 Reputation points Microsoft Employee
    2023-01-18T21:42:34.5166667+00:00

    Hi @Shekar Yenagandula Thanks for posting your query on Microsoft Q&A.

    I would recommend following the step by step guide using Azure PowerShell (if not checked already) , as per your requirement, , to
    Delete an Azure Backup Recovery Services vault
    or
    Delete a Site Recovery Services vault
    If you are looking for deleting Azure Backup Recovery Services vault, please check the following pre-requisites :
    User's image

    If you meet all the pre-requisites, then the next steps involve using Remove-AzRecoveryServicesVault command after Disable-AzRecoveryServicesBackupProtection command.

    If you have already tried these steps in the document and still stuck, please let me know in the comments and I can further investigate.


  3. Shekar Yenagandula 116 Reputation points
    2023-01-20T06:58:07.51+00:00

    @KarishmaTiwari-MSFT

    Get the VMVault and set the default context.

    Get RSV backup item and store it varible called A.

    Loop through container A and for each Item undo backupitem deletion

    Also get the backup item specific to VM and loop through each Item and disabling works.

    I managed to resolve. We can close this thread.