Azure Graph API调用仅获取应用程序组

aamkag61  于 2023-08-07  发布在  其他
关注(0)|答案(2)|浏览(130)

I have azure AD with 3 groups
我执行API调用来检索它
1.登录:https://login.microsoftonline.com/ ${tenantID}/oauth2/token
1.获取组:https://graph.microsoft.com/v1.0/groups
1.获取用户:https://graph.microsoft.com/v1.0/groups/ ${groupID}/成员
这是确定的,我收到3组和用户内,但现在我只需要组分配给应用程序Like this
我找不到任何方法在图形API过滤它。如果有人知道怎么做,请帮帮忙

tsm1rwdh

tsm1rwdh1#

用这种方法解决这个问题:
1.像以前一样获取所有组
1.获取分配给应用程序graph.microsoft.com/beta/servicePrincipals/${applicationId}/appRoleAssignments的组和用户
回复:

{
    "@odata.context": "https://graph.microsoft.com/beta/$metadata#appRoleAssignments",
    "value": [
        {
            "id": "tV-E7eUeFkmIemkoWcUgTkrT54btaddPtiLX96wVx0g",
            "creationTimestamp": "2018-07-06T10:43:32.548348Z",
            "principalDisplayName": "Pasha Kostohrys",
            "principalId": "${userID}",
            "principalType": "User",
            "resourceDisplayName": "azure-group-sync",
            "resourceId": "${applicationId}"
        },
        {
            "id": "ZRCxfjNVlUqrjp9Y3wuLJz6beU58dtNOvr41VsKwADo",
            "creationTimestamp": null,
            "principalDisplayName": "ops",
            "principalId": "${groupID}",
            "principalType": "Group",
            "resourceDisplayName": "azure-group-sync",
            "resourceId": "${applicationId}"
        }
    ] }

字符串
1.仅筛选不在工作分配列表中的组

7z5jn7bk

7z5jn7bk2#

获取分配给应用程序的组(服务主体)
Microsoft Graph API:

https://graph.microsoft.com/v1.0/servicePrincipals/<servicePrincipal_id/appRoleAssignedTo

字符串
Microsoft Graph powershell:

Get-MgServicePrincipalAppRoleAssignedTo -ServicePrincipalId $servicePrincipalId

相关问题