启动-OBRegistration 保管库凭据验证失败



我正在尝试使用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:localmachinemy -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 FilesMicrosoft Azure Recovery Services AgentbinModulesMSOnlineBackup'
Start-OBRegistration -VaultCredentials $CredsFilename.FilePath -Confirm:$false

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

怎么了?我该如何解决?

谢谢。

看起来您正在使用"-NotAfter (Get-Date("。添加时间(8(">

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

最新更新