是否可以通过Azure AD Graph API 或Microsoft Graph API 获取租户中的所有用户信息?

Is it possible to get all the user informations in a tenant by Azure AD Graph API or Microsoft Graph API?

Azure Active Directory v2.0 authentication libraries we can see lots of samples about how to use libraries to connect Active Directory. It seems all of them should create an application at apps.dev.microsoft.com开始。然后使用 Application ID 和新密码在客户端或服务器中间件应用程序中执行 clientIDclientSecret

这样一来,一个用户可以通过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 and this (使用 Azure AD Graph API 的唯一情况是你需要一些非常具体的东西,而你无法使用较新的 Microsoft Graph 的稳定版本 API.)

Azure AD Graph API 列出用户(不推荐)

https://graph.windows.net/myorganization/users