Start-OBRegistration Vault凭据验证失败

问题描述 投票:0回答:1

我正在尝试使用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”命令,它将起作用。

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

谢谢。

azure powershell backup
1个回答
0
投票

似乎您正在使用“ -NotAfter(Get-Date).AddHours(8)”

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

© www.soinside.com 2019 - 2024. All rights reserved.