使用Azure Powershell从组AppRole分配中获取Azure AD应用角色名称

问题描述 投票:0回答:1

我只能在只能使用Powershell访问的环境中为组分配Azure AD App角色。为了获得分配给特定AD组的AD APP角色,我使用了命令Get-AzureADGroupAppRoleAssignment -ObjectId XXXX-XXX...,其中的objectId在此处是组对象ID,它可以工作,但是问题是该命令的输出仅显示App的objectId角色,并且由于某种原因该objectId不是有效的GUID,这使我无法使用它查询应用角色的名称。

请参见下面的快照

enter image description here

azure azure-active-directory azure-powershell
1个回答
0
投票

要查询应用程序角色的名称,可以使用以下命令。

$rs = Get-AzureADGroupAppRoleAssignment -ObjectId <object-id>
foreach($r in $rs){
    $app = Get-AzureADServicePrincipal -ObjectId $r.ResourceId
    $DisplayName = ($app.AppRoles | Where-Object {$_.Id -eq $r.Id}).DisplayName
    Write-Host $DisplayName of $app.AppDisplayName
 }

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.