Share via

Help on APIs to fetch users info

Glenn Maxwell 13,346 Reputation points
2026-02-15T19:47:12.8666667+00:00

Our users are synced from on-premises AD to Entra ID. I want to fetch only those accounts in Entra, using APIs, where on-premises sync is enabled = true (i.e., users that are created on-prem and synchronized to Entra).

I do not want to include any mail contacts, distribution lists, or mail-enabled security groups that are synced from on-prem. I only need to retrieve user accounts. please guide me.

Microsoft Security | Microsoft Entra | Microsoft Entra ID
{count} votes

Answer accepted by question author
  1. Carolyne-3676 1,116 Reputation points
    2026-02-16T08:50:04.29+00:00

    Use Microsoft Graph /users and filter for synced accounts: GET https://graph.microsoft.com/v1.0/users?$filter=onPremisesSyncEnabled eq true&$select=id,displayName,userPrincipalName,onPremisesSyncEnabled — this returns user objects only (not contacts/groups), and limits results to accounts currently synced from on-prem.


0 additional answers

Sort by: Most helpful

Your answer

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