【问题标题】:Why is azure scale up runbook failing in Automation Account为什么 azure scale up runbook 在自动化帐户中失败
【发布时间】:2021-10-04 14:57:20
【问题描述】:

我有一个设置为运行帐户的自动化帐户。我正在尝试使用它来运行我从门户库中导入的 VM 扩展运行手册(来源:enter link description here)。

我收到以下错误,但我不太了解它的确切含义:

Add-AzureRmAccount : Cannot validate argument on parameter 'TenantId'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again. At line:106 char:11 + -TenantId $runAsConnectionProfile.Tenant.Id ` + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidData: (:) [Add-AzureRmAccount], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Azure.Commands.Profile.AddAzureRMAccountCommand

看起来 RunAsConnection 没有租户 ID,但是当我在门户中打开运行身份帐户时,AzureRunAsConnection 看起来有一个租户 ID。

谁能解释为什么会发生这个错误?

【问题讨论】:

  • 我能够毫无错误地执行运行手册。尝试打印$runAsConnectionProfile 对象,或者只打印TenantId 属性,看看你会得到什么。如果错误仍然存​​在,您可以尝试重新创建RunAsAccount
  • 设法修复它。 Runbook 中存在错误:Tenant.Id 应为 TenantId。我切换到Get-AzVM 而不是Get-AzureRmVm
  • 如果你指的是this line,那么它已经是TenantId了。
  • @abinitio:很高兴您能够解决您的问题。能否请您在答案部分发布您的答案。这将帮助面临同样类似问题的其他社区成员。

标签: azure powershell azure-active-directory azure-runbook runbook


【解决方案1】:

发布@abinitio 的评论作为答案,以帮助可能面临类似问题的其他社区成员。

如果您检查此line,那么您会发现我们应该使用TenentID 而不是Tenent.Id 作为RunAsConnection。

如果您在尝试获取 VM 时使用 Get-AzureRmVm 时遇到错误,请尝试使用 Get-AzVMGet-AzVM 是命令的最新形式,用于管理 ARM 资源,并取代 Get-AzureRmVM

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-03-15
    • 2020-07-24
    • 2020-09-16
    • 2020-12-09
    • 1970-01-01
    • 2018-09-21
    • 1970-01-01
    • 2019-05-17
    相关资源
    最近更新 更多