【发布时间】:2021-06-21 07:49:27
【问题描述】:
我正在尝试使用 azure 自动化运行 Get-AzADApplication cmdlet。我已经检查了我的所有订阅,并且 Runas 帐户中都有“贡献者”。我仍然收到以下错误。我知道错误提示权限不足,但是我的所有订阅中的帐户都有“贡献者”,这不可能是真的,对吧?
Get-AzADApplication :权限不足,无法完成操作。 在 line:41 char:21
-
$Applications = Get-AzADApplication -
~~~~~~~~~~~~~~~~~~~- CategoryInfo : InvalidOperation: (:) [Get-AzADApplication],异常
- FullyQualifiedErrorId : Microsoft.Azure.Commands.ActiveDirectory.GetAzureADApplicationCommand
这是我的代码的第一个小 sn-p,它无法通过 Get-AzADApplication
# Ensures you do not inherit an AzContext in your runbook
Disable-AzContextAutosave –Scope Process
$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
}
#Get Applications
$Applications = Get-AzADApplication
$ServicePrincipals = Get-AzADServicePrincipal
【问题讨论】:
标签: azure automation azure-automation