Remove recovery service vault completely from azure vm using PowerShell

asked 2023-01-18T19:31:28.9866667+00:00
ShekarYenagandula 56 Reputation points

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.
774 questions
Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
4,561 questions
No comments
{count} votes

3 answers

Sort by: Most helpful
  1. answered 2023-01-18T21:31:15.02+00:00
    Tasadduq Burney 7,181 Reputation points Microsoft MVP

    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. answered 2023-01-18T21:42:34.5166667+00:00
    KarishmaTiwari-MSFT 10,701 Reputation points Microsoft Employee

    Hi @ShekarYenagandula 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. answered 2023-01-20T06:58:07.51+00:00
    ShekarYenagandula 56 Reputation points

    @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.