【发布时间】: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