Not getting full users from Azure AD from ServiceNow Integration
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2025 10:37 PM
Dear All
We are trying to pull the users from Azure AD, but unfortunately we are getting only few users out of 11000+
also tried using top=999 in the API call
any leads?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2025 10:54 PM
Several factors could impact the number of users returned, check bellow points:
The Azure AD Graph API and Microsoft Graph API both use pagination to limit the number of items returned in a single API call. Even if you specify a top=999 parameter, it will only retrieve up to 999 records per call. To fetch all users, you need to handle pagination and fetch subsequent pages of data.
Ensure that the ServiceNow instance is using an Azure AD application with sufficient permissions to access all user data.
If you're using the Azure AD Connector in ServiceNow, check the configuration for any limits or filters that might restrict the number of users returned.
ensure there is no syncing issue between ServiceNow and Azure AD, such as timeout errors or incomplete mappings.
I hope my answer helps you to resolve your issue, if yes please mark my answer helpful and correct.
thank you
Rajesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2025 11:25 PM
Hi Rajesh
Checked everything, all looks good from Azure and ServiceNow
but still we need only users with specific email id , Can we write any filter?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2025 11:44 PM
Yes, if you're using the Microsoft Graph API to get user data, you can filter users based on their email addresses (or any other properties) directly within the API call itself. The Graph API supports OData queries, which allow you to filter data at the server side.
For example, to retrieve users with a specific email domain or address, you can use the $filter query parameter in the API call.
Example API Call to Filter by Email:
GET https://graph.microsoft.com/v1.0/users?$filter=endswith(mail,'@example.com')
You can modify the filter condition to match your exact use case, such as filtering by specific email addresses or domains.
If you're pulling all Azure users into ServiceNow and need to filter them after the data is retrieved, you can do that within your ServiceNow script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2025 12:49 AM
Getting below
{"error":{"code":"BadRequest","message":"Parsing OData Select and Expand failed: Term 'manager?filter=endswith(mail,'@exmple.com')' is not valid in a $select or $expand expression.","innerError":{"date":"2025-02-27T08:48:18","request-id":"68c77077-72f5-4b53-9749-555d422d78ea","client-request-id":"68c77077-72f5-4b53-9749-555d422d78ea"}}}