This article provides a solution to an issue where the Microsoft Graph REST API List users only returns one user in a directory.
Symptoms
Consider the following scenario:
-
You sign in to Microsoft Graph Explorer by selecting the profile icon at the top right.
:::image type="content" source="media/only-one-user-returned-by-microsoft-graph-list-users-api/microsoft-graph-explorer-sign-in.png" alt-text="Screenshot that shows the sign-in button in Microsoft Graph Explorer." lightbox="media/only-one-user-returned-by-microsoft-graph-list-users-api/microsoft-graph-explorer-sign-in.png":::
-
After sign-in, you try to run this query
GET https://graph.microsoft.com/v1.0/usersto retrieve all users in your directory.
In this case, only one user is returned. The expected output is a list of multiple users from the directory.
Cause
This issue occurs because you sign in with a personal Microsoft account (MSA), as shown in the preceding screenshot. Personal accounts don't have access to organizational directory data in Microsoft Entra ID. As a result, the query only returns the user associated with the personal account.
Solution
To retrieve all users in the directory, you must sign in to Microsoft Graph Explorer using an organizational Microsoft Entra account, such as userPrincipalName = name@tenant.onmicrosoft.com.
Source: Microsoft Learn / IT Pro troubleshooting by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.
