I am getting dummy users in /users end-point.

nikunj.gupta 0 Reputation points
2024-05-15T20:19:45.22+00:00

When I am making a call to https://graph.microsoft.com/v1.0/users end-point then I am getting lot of dummy users with emails like -

_aab_._aab_@xys.com

Where xyz is my domain. Total number of users exceeds 1 lakh. How can I get the correct data here.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,879 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. CarlZhao-MSFT 37,956 Reputation points
    2024-05-16T06:01:39.6233333+00:00

    When querying the Microsoft Graph API for users, it’s not uncommon to encounter a large number of dummy or service accounts, especially in larger directories. To filter out these dummy users and retrieve only the relevant user data, you can use the $filter query parameter to exclude accounts based on certain criteria, such as email patterns or account properties that are typical of real users.

    For example, you could construct a query that excludes users with emails that match the dummy pattern you’ve mentioned. Here’s how you might structure your query to filter out users with email addresses that contain 'aab':

    https://graph.microsoft.com/v1.0/users?$filter=not(startswith(mail, '_aab_'))
    

    This uses the function to exclude any user whose email starts with 'aab'. You can adjust the startswith filter to match the specific patterns of the dummy accounts in your domain.

    Additionally, you might want to consider using other properties to filter users, such as accountEnabled, assignedLicenses, or other attributes that can help you distinguish between real and dummy accounts.

    If you’re still facing issues or need more refined filtering, you might want to look into using the advanced query capabilities, which offers more complex filtering options.

    Please ensure that you have the necessary permissions to perform these queries and that you’re following your organization’s data governance policies when accessing user data. If you need further assistance, feel free to ask!

    0 comments No comments