使用图形资源管理器或 Postman 生成用于列出组用户的访问令牌

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

我只是想探索 Azure 和 Graph 浏览器,想要发布 Web 应用程序和组,并让用户使用来读取组的用户。我尝试过,但收到权限不足的错误。我可以使用 Graph Explorer 或 Postman 中的任何一个

我尝试过,但出现权限不足的错误。

azure azure-active-directory graph-explorer
1个回答
0
投票

由于您错过了对添加的 API 权限授予管理员同意,因此发生错误。

使用以下 HTTPS 命令创建应用程序:

POST https://graph.microsoft.com/v1.0/applications
Content-type: application/json

{
  "displayName": "Display name"
}

enter image description here

使用默认设置创建应用程序:

enter image description here

要解决该错误,请添加 Application

 类型的 
GroupMember.Read.All 权限,并确保授予 管理员同意

已授予 API 权限

**GroupMember.Read.All**
并获得 管理员同意:

enter image description here

现在创建应用程序后,我将创建组并向其添加成员。我使用了下面的命令

POST https://graph.microsoft.com/v1.0/groups
Content-Type: application/json

{
  "description": "Group with desmembers",
  "displayName": "Testing55Group",
  "groupTypes": [
  ],
  "mailEnabled": false,
  "mailNickname": "Testing55",
  "securityEnabled": true,

  "[email protected]": [
    "https://graph.microsoft.com/v1.0/users/user1-id",
    "https://graph.microsoft.com/v1.0/users/user2-id"
  ]
}
By using above command, we created two members for that group.

注意:通过用户的

user-id
选择群组成员。

现在,在 Postman 的帮助下使用客户端凭据流生成访问令牌,

POST https://login.microsoftonline.com/tenantId/oauth2/v2.0/token
grant_type:client_credentials 
client_id:appID
client_secret:secret 
scope: https://graph.microsoft.com/.default

访问令牌:

enter image description here

现在列出在

group-id
帮助下创建的群组成员。

使用以下命令

https://graph.microsoft.com/v1.0/groups/group-id/members

enter image description here

参考资料:

与 Group.Member.ReadAll 相关的文档

列出群组成员

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