Azure自动化中是否可以有多个runas帐户?
我在网上搜索了Microsoft文章,但找不到答案。
答案 0 :(得分:1)
不必是另一个AzureRunAs帐户。运行手册使用连接和证书的组合进行身份验证。 因此,您可以添加一个新连接,并使它使用其他服务主体。 首先添加一个证书,然后创建连接并配置服务主体。我从未测试过针对不同/多个连接使用相同的AzureRunAs证书,但是如果可能的话,值得进行测试。 除了必须更改连接名称等之外,用于运行簿身份验证的代码基本相同。
在门户中查看:
Automation accounts -> Select the account -> Certificates
Automation accounts -> Select the account -> Connections
我的代码段:
$connectionName = "CustomConnectionNameHere";
Try {
# Get the connection "AzureRunAsConnection "
$servicePrincipalConnection = Get-AutomationConnection -Name $connectionName
"Logging in to Azure..."
Add-AzureRmAccount `
-ServicePrincipal `
-TenantId $servicePrincipalConnection.TenantId `
-ApplicationId $servicePrincipalConnection.ApplicationId `
-CertificateThumbprint $servicePrincipalConnection.CertificateThumbprint
} catch {
if (!$servicePrincipalConnection)
{
$ErrorMessage = "Connection $connectionName not found."
throw $ErrorMessage
} else{
Write-Error -Message $_.Exception
throw $_.Exception
}
}
答案 1 :(得分:0)
否,您只能有两个“运行方式”帐户。(在CSP订阅中,您只能有新的“运行方式”帐户。)一个用于管理新的ARM资源,另一个用于管理经典资源。