下午好
我猜想这个关系是正确的:
Azure Tenant
» Azure Subscription
» Azure Automation
» Runbook
因此我有这个问题:
是否有 PowerShell 命令可用于获取运行 Runbook 的 TenantID?
最佳答案
如果您想在 Runbook 中运行命令,可以使用以下命令:
$servicePrincipalConnection = Get-AutomationConnection -Name "AzureRunAsConnection"
Write-Output $servicePrincipalConnection.TenantId
注意:有一个前提条件,当您创建自动化帐户时,需要选择Create Azure Run As account
和Yes
,否则是AzureRunAsConnection
不存在。
关于Azure 自动化 : Runbook: does it know it's TenantID?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61363861/