azure - 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”命令,它就可以工作。
有什么问题?我该如何解决?
谢谢你。
解决方案
看起来您正在使用“-NotAfter (Get-Date).AddHours(8)”
这将使您的证书在 8 小时后过期,默认为 1 年。
推荐阅读
- azure - 提供 Azure 托管标识 Directory.Read.All
- angular - NGRX 选择器抛出无法读取未定义的属性“tourProvider”
- javascript - 事件声明中是否需要“function()”?
- string - 基于字符串评估创建新的位列
- hyperledger-fabric - Hyperledger Fabric 中orderer genesis block 的重要性是什么?
- excel - 从单元格引用中获取文件名和路径
- ilog - 为决策表中创建的新行生成 ID(用户不可编辑)
- javascript - 如何在 NodeJS 中使用 IMAP 通过 messageId 获取电子邮件线程?
- amazon-web-services - S3 和大文件备份
- c# - 当参数类型是基类时将派生类传递给方法