使用Graph API检查(Active Directory)中的用户列表

时间:2015-01-15 05:52:04

标签: c# asp.net-web-api azure-active-directory

我要求检查Azure中的Active Directory验证用户列表。 这些用户不属于任何组。我会将用户列表传递给root用户,并且必须在AD中检索用户是否有效。

1 个答案:

答案 0 :(得分:2)

如果要查询Azure Active Directory,请在过滤器中使用带有多个或子句的GET查询。类似的东西:

HTTP GET https://graph.windows.net/7fe877e6-a150-4992-bbfe-f517e304dfa0/users?api-version=1.5&$filter=displayName eq 'Ellen Adams' or displayName eq ' Aaron Painter' or displayName eq 'John Yokum'

过滤器也支持其他属性的比较(如userPrincipalName):

HTTP GET https://graph.windows.net/7fe877e6-a150-4992-bbfe-f517e304dfa0/users?api-version=1.5&$filter=userPrincipalName eq 'EllenA@aaddemo.com' or use rPrincipalName eq 'AaronP@aaddemo.com' or userPrincipalName eq 'JohnY@aaddemo.com'

请参阅有关过滤器的参考文档:http://msdn.microsoft.com/en-us/library/azure/dn727074.aspx

此外,如果用户数量非常大(超过查询字符串限制) - 批量多个请求。

最后,以下是一些调用Graph API的示例应用程序:https://github.com/AzureADSamples?query=graph

希望有所帮助