Query if a user is in any of multiple given groups - Microsoft Graph Explorer

Angela Willingham 1 Reputation point
2021-05-12T15:49:20.807+00:00

I am trying to come up with a query using Microsoft Graph Explorer that will check if the logged in user is part of any of the named security groups. Just for clarification I want to know if they are part of any of the ones listed and which ones from that list. The query below works for finding out if they are in one but I cant figure out how to add 'or' to add multiple options. Any help would be appreciated.

https://graph.microsoft.com/v1.0/me/memberOf?$filter=id eq 'insert group ID here'

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,546 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Dan Kershaw 416 Reputation points Microsoft Employee
    2021-10-13T21:07:51.31+00:00

    Try using checkMemberGroup. See https://learn.microsoft.com/en-us/graph/api/directoryobject-checkmembergroups?view=graph-rest-1.0&tabs=http for details and examples.

    The other way you can do this is using advanced query capabilities (https://learn.microsoft.com/en-us/graph/aad-advanced-queries?context=graph%2Fapi%2F1.0&view=graph-rest-1.0):

    GET https://graph.microsoft.com/v1.0/me/memberOf?$filter=id in ('{id1}','{id2}','{id3}')&$count=true
    ConsistencyLevel: eventual

    NOTE the HTTP header...

    Hope this helps,
    Dan

    0 comments No comments