我正在尝试使用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”命令,则它可以正常工作。
出什么问题了?我该怎么解决?
谢谢。
答案 0 :(得分:0)
您似乎正在使用“ -NotAfter(Get-Date).AddHours(8)”
这将使您的证书在8小时后过期,默认值为1年。