Unable to Retrieve Members Not Synced from On-Premises Using Microsoft Graph API.

Bryn, Robert L 41 Reputation points
2023-12-01T15:34:48.9966667+00:00

I have a requirement to find all users in EntraID that are UserType "member" and are NOT Synced from on-premises. It doesn't appear that I can find users with null values. or not equals to true.

I've tried

https://graph.microsoft.com/v1.0/users?$filter=usertype eq 'Member' and onPremisesSyncEnabled+ne+true&$count=true

*fails with an error

    "error": {
        "code": "Request_UnsupportedQuery",
        "message": "Filter operator 'NotEqualsMatch' is not supported.",
  

if I try checking for null using the query below, it throws a different error

https://graph.microsoft.com/v1.0/users?$filter=usertype eq 'Member' and onPremisesSyncEnabled+eq+null&$count=true

.

  "error": {

        "code": "Request_UnsupportedQuery",
        "message": "Unsupported or invalid query filter clause specified for property 'onPremisesSyncEnabled' of resource 'User'.",

Is there something I'm missing?

Microsoft Security | Microsoft Entra | Microsoft Entra ID
Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

Accepted answer
  1. Vasil Michev 119.8K Reputation points MVP Volunteer Moderator
    2023-12-01T16:37:17.9833333+00:00

    This is an "advanced" query, so when running it make sure to include the consistencyLevel=eventual header as detailed in the official documentation: https://learn.microsoft.com/en-us/graph/aad-advanced-queries?tabs=http

    Once you add the header, it works just fine.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.