首页 > 解决方案 > Start-OBRegistration Vault 凭据验证失败

问题描述

我正在尝试使用 powershell 脚本将 Windows 客户端计算机注册到 Azure Recovery Services Vault。

我有这个错误:

WARNING: Vault credentials validation failed.
Start-OBRegistration : Vault credentials file provided has expired. We recommend you download a new vault credentials file from the portal and use it within 2 days.

这些是我的命令:

$cert = New-SelfSignedCertificate -certstorelocation cert:\localmachine\my -dnsname aly20-srv.xxx.onmicrosoft.com -NotAfter (Get-Date).AddHours(8)
$certificate =[System.Convert]::ToBase64String($cert.RawData)

$Vault1 = Get-AzRecoveryServicesVault –Name "rsvault-staging"
$CredsPath = "C:\temp"
$CredsFilename = Get-AzRecoveryServicesVaultSettingsFile -Backup -Vault $Vault1 -Path $CredsPath -Certificate $certificate

Import-Module -Name 'C:\Program Files\Microsoft Azure Recovery Services Agent\bin\Modules\MSOnlineBackup'
Start-OBRegistration -VaultCredentials $CredsFilename.FilePath -Confirm:$false

在“C:\temp”中创建的保管库凭据文件似乎无效。如果我尝试直接从 azure 门户获取它并运行“Start-OBRegistration”命令,它就可以工作。

有什么问题?我该如何解决?

谢谢你。

标签: azurepowershellbackup

解决方案


看起来您正在使用“-NotAfter (Get-Date).AddHours(8)”

这将使您的证书在 8 小时后过期,默认为 1 年。


推荐阅读