Search code examples
azure-active-directoryazure-ad-graph-api

AAD graph api usageLocation eq null filter query not supported


Graph explorer returns unsupported query when I execute

https://graph.microsoft.com/v1.0/users?$select=id,usageLocation&$filter=usageLocation+eq+null

However, the filter for null on usageLocation should be supported according to documentation: https://learn.microsoft.com/en-us/graph/aad-advanced-queries?tabs=http

Am I missing something, or is the documentation wrong here?


Solution

  • I tried to reproduce the same in my environment and got below results:

    When I ran same query as you in Graph Explorer, I too got same error like this:

    GET https://graph.microsoft.com/v1.0/users?$select=id,usageLocation&$filter=usageLocation+eq+null
    

    Response:

    enter image description here

    As mentioned in this MS documentation,

    Requires advanced query
parameters. The $filter operator requires advanced query parameters, which are: ConsistencyLevel=eventual header and $count=true query string

    To resolve the error, you need to add advanced query parameters like below:

    GET https://graph.microsoft.com/v1.0/users?$select=id,usageLocation&$filter=usageLocation+eq+null&$count=true
    ConsistencyLevel: eventual
    

    Response:

    enter image description here