Using OData filters are flexible when filtering Entra ID (Azure AD) users for larger organizations.
Microsoft API supported filters
Property Name | Type |
accountEnabled | Boolean |
city | String |
country | String |
department | String |
displayName | String |
givenName | String |
jobTitle | String |
mail | String |
mailNickname | String |
onPremisesImmutableId | String |
proxyAddresses | String collection |
state | String |
surname | String |
usageLocation | String |
userPrincipalName | String |
userType | String |
For more details about these properties, click on the Microsoft link below and search 'Supports $filter'. Only the properties marked with 'Supports $filter' are supported in Microsoft Graph API.
https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/resources/user#properties
Logical Operators
The logical operators supported are shown in the following table.
eq | Equal | city eq 'Atlanta' |
and | Logical and | city eq 'Atlanta' and city eq 'London' |
or | Logical or | city eq 'Atlanta' or city eq 'London' |
startswith | Starts with | startswith(mail, 'administrator@') |
Note: The following $filter operators are not supported for Entra ID (Azure AD) resources: ne, gt, ge, lt, le, and not. The contains string operator is currently not supported on any Microsoft Graph resources. See Microsoft Reference.
OData examples
Return all users in one country.
Return all users in from multiple countries
Returns all users that are enabled from multiple cities and multiple departments
Returns certain users within a Department that are enabled.
Returns all users with city equal to London or New York
General filter that will returns only user accounts that are not disabled and has job title
Learn more:
IT Pro: How to filter users in Azure AD using Client-Side.
IT Pro: How to Sync Custom Attribute of Azure AD to Xink Portal (Hybrid AAD)
OData expression syntax for filters and order-by clauses in Azure Search:
https://docs.microsoft.com/en-us/rest/api/searchservice/odata-expression-syntax-for-azure-search