运行手册结果中显示的额外 azure 帐户信息 azure automation
extra azure account information showing in runbook results azure automation
我想知道如何摆脱每次我 运行 我的 azure 自动化 运行 书中的脚本时显示的额外帐户信息。必须有一种方法可以将其删除,我们将不胜感激。
您可以附加 Out-Null to the commands that will output your account information. It hides the output instead of sending it down the pipeline or displaying it. See other ways 以忽略输出。
例如:
$connectionName = "AzureRunAsConnection"
try
{
# Get the connection "AzureRunAsConnection "
$servicePrincipalConnection=Get-AutomationConnection -Name $connectionName
Connect-AzAccount `
-ServicePrincipal `
-TenantId $servicePrincipalConnection.TenantId `
-ApplicationId $servicePrincipalConnection.ApplicationId `
-CertificateThumbprint $servicePrincipalConnection.CertificateThumbprint | Out-Null
}
catch {
if (!$servicePrincipalConnection)
{
$ErrorMessage = "Connection $connectionName not found."
throw $ErrorMessage
} else{
Write-Error -Message $_.Exception
throw $_.Exception
}
}
结果
我想知道如何摆脱每次我 运行 我的 azure 自动化 运行 书中的脚本时显示的额外帐户信息。必须有一种方法可以将其删除,我们将不胜感激。
您可以附加 Out-Null to the commands that will output your account information. It hides the output instead of sending it down the pipeline or displaying it. See other ways 以忽略输出。
例如:
$connectionName = "AzureRunAsConnection"
try
{
# Get the connection "AzureRunAsConnection "
$servicePrincipalConnection=Get-AutomationConnection -Name $connectionName
Connect-AzAccount `
-ServicePrincipal `
-TenantId $servicePrincipalConnection.TenantId `
-ApplicationId $servicePrincipalConnection.ApplicationId `
-CertificateThumbprint $servicePrincipalConnection.CertificateThumbprint | Out-Null
}
catch {
if (!$servicePrincipalConnection)
{
$ErrorMessage = "Connection $connectionName not found."
throw $ErrorMessage
} else{
Write-Error -Message $_.Exception
throw $_.Exception
}
}
结果