很抱歉这篇文章很长:
我正在尝试清理我们的 Azure 帐户,但有几个旧保管库不允许我删除它们。我已经尝试了一些方法,但仍坚持从 Powershell 得到的一些响应。
首先尝试在 Azure 门户中删除保管库并收到以下消息:
Vault cannot be deleted as there are existing resources within the vault. Please ensure there are no backup items, protected servers or backup management servers associated with this vault. Unregister the following containers associated with this vault before proceeding for deletion :
环顾四周,微软表示要从保管库中删除该服务器。服务器仍然在线,但 azure 备份实用程序无法从我能找到的 azure 帐户中取消注册。我可以在服务器门户中点击删除按钮,但在确认删除后,它什么也不做,对象仍然存在。
查找 PowerShell 命令并在此处找到另一篇文章:
https://serverfault.com/questions/838463/azure-recoveryservicevault-cant-be-removed/839848#839848
但是前几个命令返回错误:
$vault = Get-AzureRmRecoveryServicesVault -Name "My Server Name"
Set-AzureRmRecoveryServicesVaultContext -Vault $vault
Set-AzureRmRecoveryServicesVaultContext : Cannot validate argument on parameter 'Vault'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again. At line:2 char:48 + Set-AzureRmRecoveryServicesVaultContext -Vault $vault + ~~~~~~ + CategoryInfo : InvalidData: (:) [Set-AzureRmRecoveryServicesVaultContext], ParameterBindingVa lidationException + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Azure.Commands.RecoveryServices.Bac kup.Cmdlets.SetAzureRmRecoveryServicesVaultContext
technet 上的另一篇文章表示,如果它是较旧的备份保管库,请尝试不同的命令,这就是
$vault = Get-AzureRmRecoveryServicesBackupContainer -Name "My Server Name"
Set-AzureRmRecoveryServicesVaultContext -Vault $vault
但是,我再次收到错误:
Get-AzureRmRecoveryServicesBackupContainer : The term 'Get-AzureRmRecoveryServicesBackupContainer' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:10 + $vault = Get-AzureRmRecoveryServicesBackupContainer -Name "WDSE ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Get-AzureRmR...ackupContainer:String) [], CommandNotFound Exception + FullyQualifiedErrorId : CommandNotFoundException
我不知道从这里该去哪里,如果有任何建议,我将不胜感激。
这是我在门户中看到的备份项目以及如何处理它们的选项。
谢谢
最佳答案
Vault cannot be deleted as there are existing resources within the vault. Please ensure there are no backup items, protected servers or backup management servers associated with this vault. Unregister the following containers associated with this vault before proceeding for deletion :
您可以按照以下步骤在保管库中查找现有资源:
在该保管库中当前没有备份项目之前,您无法删除该保管库。希望对您有帮助。
更新
感谢您上传图片来澄清问题。我假设您通过 Azure 备份代理在本地服务器上有 D:\xxx 的备份,并且您想要删除恢复服务保管库以及该保管库中的相关资源备份。如果是这样,我建议执行以下步骤:
- 卸载绑定(bind)要删除的恢复服务保管库的 Azure 备份代理。在此之前,您需要停止计划备份并清理存储的备份。更多详情Uninstalling the Azure Backup agent
使用 Windows powershell,使用命令
Connect-AzureRmAccount
登录您的 Azure 门户帐户,运行以下命令来取消注册备份容器。有关命令的更多详细信息 here然后返回 Azure 门户,您应该会看到备份项目中没有任何项目。现在您可以在 Azure 门户中删除恢复服务保管库。
关于powershell - 无法删除 azure 恢复服务保管库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50729812/