一部のプロセスを自動化するために、RunAsAccount の所有者権限を持つAzure Automationを使用しています。
$connection = Get-AutomationConnection -Name AzureRunAsConnection
while(!($connectionResult) -And ($logonAttempt -le 10))
{
$LogonAttempt++
# Logging in to Azure...
$connectionResult = Connect-AzAccount `
-ServicePrincipal `
-Tenant $connection.TenantID `
-ApplicationId $connection.ApplicationID `
-CertificateThumbprint $connection.CertificateThumbprint
Start-Sleep -Seconds 30
Write-Output $connectionResult
}
Get-AzRoleAssignment -ResourceGroupName $USERRGNAME -SignInName $USEREMAIL -verbos
スクリプトを実行するたびにエラーがスローされます。
Get-AzRoleAssignment: Cannot find principal using the specified options
この問題を解決するためのアイデアはありますか?