Closed Apholisha closed 5 years ago
@siddharth7 Can you take a look?
@apholisha the documentation that you mentioned belongs to azure site recovery vault. If you are referring to the backup vault, this is the correct documentation (https://docs.microsoft.com/en-us/azure/backup/backup-azure-delete-vault). It also mentions that you need to remove all protected items and unregister containers before deleting the vault.
Apologies , I thought all Backup vaults have been upgraded to Recovery Services vaults. and they are now essentially the same.
Regardless - the feature would be nice to have. I did write myself a function to do it, but it would be nice to have it as a parameter for example.
It is not provided as a feature to avoid deleting vaults by mistake as it is an irreversible process.
Description
Remove-AzRecoveryServicesVault would fail to delete vault if there are protected items in it. According to the documentation it is not required for the vault to be cleaned up in advance.
https://docs.microsoft.com/en-gb/powershell/module/az.recoveryservices/remove-azrecoveryservicesvault?view=azps-2.1.0
This article explicitly states that the vault does not need to be cleaned up. https://docs.microsoft.com/en-us/azure/site-recovery/delete-vault
Furthermore the error that it gives out normally cryptic. Unless you resolve the error explicitly you would get:
Steps to reproduce
Select-AzSubscription
$vault = Get-AzRecoveryServicesVault -Name "testTemplated"
Remove-AzRecoveryServicesVault -Vault $vault
Name Value
PSVersion 5.1.17134.765
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17134.765
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Debug output
Error output