Raja Rajendraprasath
Raja Rajendraprasath

Reputation: 222

Check list of users present in (Active Directory) using Graph API

I have on requirement to check the list of users validate against active directory in Azure. those users are not belongs to any group. i will pass list of users to the root and it has to retrive the users in the AD valid or not.

Upvotes: 0

Views: 549

Answers (1)

Dushyant Gill
Dushyant Gill

Reputation: 4004

If you wish to query Azure Active Directory - use a GET query with multiple or clauses in the filter. Something like:

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'

Filter supports comparison on other properties too (like userPrincipalName):

HTTP GET https://graph.windows.net/7fe877e6-a150-4992-bbfe-f517e304dfa0/users?api-version=1.5&$filter=userPrincipalName eq '[email protected]' or use rPrincipalName eq '[email protected]' or userPrincipalName eq '[email protected]'

See reference doc on filter here: http://msdn.microsoft.com/en-us/library/azure/dn727074.aspx

Also, if the number of users is very large (exceeds query string limits) - batch multiple requests.

Finally, here are some sample applications that calls Graph API: https://github.com/AzureADSamples?query=graph

Hope that helps

Upvotes: 2

Related Questions