使用图 API 来自组 azure AD 的 user/members 计数

Count of user/members from group azure AD using graph API

我需要使用 Graph API 对 Azure AD 中的每个组进行计数。谁能告诉我如何实现它

目前没有 Microsoft Graph 终结点来获取用户数。

您可以使用以下方式列出成员:

GET https://graph.microsoft.com/v1.0/groups/{id}/members

然后在您的代码中处理成员计数。

参见参考 here. Try it quickly with Microsoft Graph Explorer

我也遇到了类似的问题。当我 运行 https://docs.microsoft.com/en-us/graph/api/group-list-members?view=graph-rest-1.0&tabs=http#example-2-get-only-a-count-of-all-membership 中提到的终点时,我得到“当前不支持 $count”。

但是,如果您清楚地注意到文档,它会要求我们在 REST header 中最终发送 ConsistencyLevel。当我将 header 与呼叫一起发送时,我得到了正确的响应: GET https://graph.microsoft.com/v1.0/groups/{id}/members/$count ConsistencyLevel: eventual