About This Page
This page is part of the Azure documentation. It contains code examples and configuration instructions for working with Azure services.
Bias Analysis
Bias Types:
⚠️
powershell_heavy
⚠️
windows_tools
⚠️
windows_first
⚠️
missing_linux_example
Summary:
The documentation page demonstrates a strong Windows bias. PowerShell is the primary automation method described, with detailed steps, scripts, and prerequisites (including explicit instructions to install PowerShell 7). The ARMClient tool is installed via Chocolatey, a Windows package manager, and all management console instructions (MARS, MABS, DPM) are Windows-only. There are no Bash, Linux, or cross-platform CLI examples for on-premises or automation scenarios. The Azure CLI section is limited and notes that it only works for VM backups, with no parity for other scenarios. Linux users are left without equivalent guidance for automation or management.
Recommendations:
- Provide Bash and cross-platform Azure CLI examples for all major operations, not just VM backups.
- Document how to use PowerShell Core on Linux/macOS, or provide equivalent scripts in Bash or Python.
- For ARMClient, suggest cross-platform installation methods (e.g., via pip, npm, or direct download) and clarify usage on Linux/macOS.
- Include guidance for managing on-premises backups from non-Windows environments, or clarify limitations.
- Ensure that automation and scripting examples are not limited to Windows tools; offer alternatives or note cross-platform compatibility.
- Where Windows-specific tools are required (e.g., MARS, DPM, MABS), clearly state this and suggest any available alternatives for Linux environments.
Create pull request
Flagged Code Snippets
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:
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:
[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: