IT Pro: How to filter users in Entra ID (Azure AD) using OData

Using OData filters is a flexible and powerful way to query Entra ID (Azure AD) users, especially in larger organizations where precise targeting is essential.

Microsoft Graph API Supported Filters

The following user properties support OData filters when querying via the Microsoft Graph API:

Property NameType
accountEnabledBoolean
cityString
countryString
departmentString
displayNameString
givenNameString
jobTitleString
mailString
mailNicknameString
onPremisesImmutableIdString
proxyAddressesString collection
stateString
surnameString
usageLocationString
userPrincipalNameString
userTypeString

For the complete list of filterable properties, visit the official Microsoft documentation and search for "Supports $filter": Microsoft Graph: User Properties

Supported Logical Operators

Below are the logical operators you can use with OData filters:

OperatorDescriptionExample
eqEqualscity eq 'Atlanta'
andLogical ANDcity eq 'Atlanta' and city eq 'London'
orLogical ORcity eq 'Atlanta' or city eq 'London'
startswithStarts Withstartswith(mail, 'administrator@')

Note: The following operators are not supported for Entra ID: ne, gt, ge, lt, le, not. Also, contains is not supported in Microsoft Graph. See Microsoft Reference.

OData Filter Examples

Users from a specific country:

country eq 'United Kingdom'

Users from multiple countries:

country eq 'New Zealand' or country eq 'Australia' or country eq 'NZ' or country eq 'AU'

Enabled users from numerous departments and cities:

accountEnabled eq true and (department eq 'Marketing' or department eq 'HR' or department eq 'IT Support' or department eq 'Customer Services' or city eq 'Atlanta' or city eq 'New york' or city eq 'Los Angeles')

Enabled users in the Technology department with particular job titles:

accountEnabled eq true and department eq 'Technology' and (startswith(jobTitle,'IT') or startswith(jobTitle,'Technology'))

Users located in London or New York:

city eq 'London' or city eq 'New York'

General filter for enabled user accounts with job titles:

accountEnabled eq true

Filter examples 1

Filter examples 2

Learn More

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.
Quick 1-on-1 Demo | Ⓒ 2025 Xink