gpt4 book ai didi

azure - 如何从 Azure AD 读取数据

转载 作者:行者123 更新时间:2023-12-03 03:22:21 25 4
gpt4 key购买 nike

我有一个网络应用程序。

某个组织的系统管理员登录到我的 Web 应用程序,并且需要能够将其组织中用户的电子邮件加载到该应用程序中。

系统管理员在 Azure AD 中管理其组织的用户。

在哪里可以找到此类集成的分步过程?

我了解我需要在 Azure 市场中创建一个应用程序,并且系统管理员需要授予我的应用程序的访问权限。只是找不到应该如何端到端完成此操作的确切步骤。

谢谢

最佳答案

I understand that I need to create an app in Azure marketplace and SysAdmin need to give access permissions for my app. Just can't find the exact steps how this should be done end to end.

您需要在租户中的任何组织目录(任何 Azure AD 目录 - Multi-Tenancy )中创建一个帐户应用程序:

enter image description here

并授予 User.Read.All 委派 API 权限:

enter image description here

确保通过与另一个租户管理员用户签名来授予租户广泛的管理员同意 API 权限:

https://login.microsoftonline.com/organizations/adminconsent?client_id=ClientIDofApp

enter image description here

其他租户中的企业应用程序现在已授予 API 权限(如果未授予此权限,则会出现 403 错误):

enter image description here

我使用以下端点来授权其他组织用户:

https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize? 
client_id=ClientID
&response_type=code
&redirect_uri=https://jwt.ms
&response_mode=query
&scope=User.Read.All
&state=12345

我使用其他组织的管理员用户登录:

enter image description here

授权码已成功生成:

enter image description here

我通过 Postman 使用以下参数生成了访问 token :

https://login.microsoftonline.com/organizations/oauth2/v2.0/token

client_id:ClientID
scope:User.Read.All
grant_type:authorization_code
redirect_uri:https://jwt.ms
code:code
client_secret:ClientSecret

enter image description here

当我解码 token 时,会显示详细信息:

enter image description here

要获取管理员/其他组织中用户的电子邮件,请通过传递上述访问 token 来使用以下查询:

GET https://graph.microsoft.com/v1.0/users?$select=mail

enter image description here

引用:

Get a user - Microsoft Graph v1.0 | Microsoft

关于azure - 如何从 Azure AD 读取数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76826811/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com