想要生成一个令牌,用于访问具有特定租户的关联用户信息的应用程序

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

我是 Azure 门户的新手,我有高级 p2 订阅,我想使用客户端凭据流类型生成令牌,基本上想读取我的应用程序和与我的租户关联的用户。我正在使用 Postman 来调用 API。

我尝试过,但无法实现所需的输出。我对应该调用哪个 API 感到困惑。

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

创建了一个 Microsoft Entra ID 应用程序,如下所示:

enter image description here

注意: 如果要读取租户的所有用户和应用,请添加权限

User.Read.All
Application.Read.All

添加

Application.Read.All
User.Read.All
,如下所示:

enter image description here

现在需要通过Postman生成Access Token

GET https://login.microsoftonline.com/{tenant-id}/oauth2/v2.0/token

client_id: <application id>
client_secret: <client secret>
grant_type: client_credentials
scope: https://graph.microsoft.com/.default

生成的访问令牌:

enter image description here

成功生成访问令牌后,现在使用访问令牌列出租户中的用户和应用程序。

1。列出用户

GET https://graph.microsoft.com/v1.0/users

enter image description here

2.列出应用程序

GET https://graph.microsoft.com/v1.0/applications

enter image description here

参考资料:

列出用户

列出应用程序

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