Create Pull Request
| Date | Scan | Status | Result |
|---|---|---|---|
| 2025-07-12 23:44 | #41 | cancelled |
Biased
|
| 2025-07-12 00:58 | #8 | cancelled |
Clean
|
| 2025-07-10 05:06 | #7 | processing |
Clean
|
For more information, see this [article](/cli/azure/backup/vault)
# [Azure Resource Manager](#tab/arm)
Delete the Recovery Services vault using Azure Resource Manager is recommended only if all of the dependencies are removed and you're still getting the *Vault deletion error*. Try any or all of the following tips:
- From the **Essentials** pane in the vault menu, verify that there aren't any backup items, backup management servers, or replicated items listed. If there are backup items, refer to the [Before you start](#before-you-start) section.
- Try [deleting the vault from the portal](#delete-the-recovery-services-vault) again.
- If all of the dependencies are removed and you're still getting the *Vault deletion error*, use the ARMClient tool to perform the following steps (after the note).
1. Go to [chocolatey.org](https://chocolatey.org/) to download and install Chocolatey. Then, install ARMClient by running the following command:
`choco install armclient --source=https://chocolatey.org/api/v2/`
2. Sign in to your Azure account, and then run the following command:
`ARMClient.exe login [environment name]`
3. In the Azure portal, gather the subscription ID and resource group name for the vault you want to delete.
For more information on the ARMClient command, see [ARMClient README](https://github.com/projectkudu/ARMClient/blob/master/README.md).
### Use the Azure Resource Manager client to delete a Recovery Services vault
1. Run the following command by using your subscription ID, resource group name, and vault name. If you don't have any dependencies, the vault is deleted when you run the following command:
1. Open PowerShell 7 as administrator.
- **Step 3:** Save the PowerShell script in .ps1 format. Then, to run the script in your PowerShell console, type `./NameOfFile.ps1`. This recursively deletes all backup items and eventually the entire Recovery Services vault.
>[!Note]
>To access the PowerShell script for vault deletion, see the [PowerShell script for vault deletion](./scripts/delete-recovery-services-vault.md) article.
**Run the script in the PowerShell console**
This script performs the following actions:
1. Disable soft delete and security features
1. Delete backup items
1. Unregister servers and storage accounts
1. Delete Disaster Recovery items
1. Remove private endpoints
To delete an individual backup items or write your own script, use the following PowerShell commands:
- Stop protection and delete the backup data:
If you're using SQL in Azure VMs backup and enabled autoprotection for SQL instances, first disable the autoprotection.
[Learn more](/powershell/module/az.recoveryservices/disable-azrecoveryservicesbackupautoprotection) on how to disable protection for an Azure Backup-protected item.
- Stop protection and delete data for all backup-protected items in cloud (for example, IaaS VM, Azure file share, and so on):
[Learn more](/powershell/module/az.recoveryservices/disable-azrecoveryservicesbackupprotection) about disabling protection for a Backup-protected item.
After deleting the backed-up data, unregister any on-premises containers and management servers.
- For on-premises Files and Folders protected using Azure Backup Agent (MARS) backing up to Azure:
[Learn more](/powershell/module/az.recoveryservices/unregister-azrecoveryservicesbackupcontainer) about unregistering a Windows Server or other container from the vault.
- For on-premises machines protected using MABS (Microsoft Azure Backup Server) or DPM to Azure (System Center Data Protection Manage:
[Learn more](/powershell/module/az.recoveryservices/unregister-azrecoveryservicesbackupcontainer) about unregistering a Backup management container from the vault.
After permanently deleting backed up data and unregistering all containers, proceed to delete the vault.
To delete a Recovery Services vault: