来自Azure Active Directory v2.0 authentication libraries我们可以看到很多关于如何使用库连接 Active Directory 的示例。看来他们所有人都应该在 apps.dev.microsoft.com 创建一个应用程序第一的。然后使用Application ID
和新密码在客户端或服务器中间件应用程序中充当clientID
和clientSecret
。
这样,一个用户就可以使用该应用程序通过 Azure Active Directory API
通过 oauth 2 或 openid 登录。还可以正确获取用户个人资料等个人信息。
但是,如果我想一次性获取某个租户中的所有用户信息,有API可以做到吗?
最佳答案
But, if I want to get all the users information in a tenant one time, is there an API can do?
您可以使用 Microsoft Graph API - 特别是 List Users API .
https://graph.microsoft.com/v1.0/users
要进行快速测试,请尝试使用 Microsoft Graph Explorer
<小时/>同样,您也可以使用 Azure AD Graph API 列出用户,但建议使用 Microsoft Graph API。
阅读Microsoft Graph or Azure AD Graph还有这个SO Post (使用 Azure AD Graph API 的唯一情况是,如果您需要一些非常具体的东西,而您无法使用较新的 Microsoft Graph API 的稳定版本来实现。)
用于列出用户的 Azure AD Graph API(不推荐)
https://graph.windows.net/myorganization/users
关于azure - 是否可以通过Azure AD Graph API或Microsoft Graph API获取租户中的所有用户信息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53137662/