Skip to content

Commit 7febb0b

Browse files
authored
commit
1 parent 780b9ef commit 7febb0b

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
title: Can't look up users using Microsoft Graph /users endpoint
3+
description: Provides a solution to an issue where a user can't look up other users using the Microsoft Graph /users endpoint when a tenant policy configuration restricts access.
4+
ms.date: 04/23/2025
5+
ms.service: entra-id
6+
ms.custom: sap:Getting access denied errors (Authorization)
7+
ms.reviewer: daga, v-weizhu
8+
---
9+
# 401 HTTP response when looking up users using Microsoft Graph /users endpoint
10+
11+
You can use the Microsoft Graph endpoint to interact programmatically with your tenant data. A common scenario is a Microsoft Graph `/users` endpoint to look up users in the tenant. In this scenario, if you use delegated permissions in your access token, the `User.Read.All` permission is necessary. However, there are ways to prevent you from looking up other users, for example, using an [authorization policy](https://learn.microsoft.com/en-us/graph/api/resources/authorizationpolicy) that can control Microsoft Entra authorization settings.
12+
13+
This article provides a solution to an issue where you can't look up other users using the Microsoft Graph `users` endpoint when a tenant policy configuration restricts access.
14+
15+
## Symptoms
16+
17+
After you enable an authorization policy in your tenant to prevent the user lookup action, if a new application performs this action, it gets a 401 HTTP response. This issue occurs even though proper permissions are consented to on the app registration and the access token has the proper permission. It doesn't occur with tenant administrators.
18+
19+
## Cause
20+
21+
The `allowedToReadOtherUser` property on the [authorization policy](/graph/api/resources/authorizationpolicy) is set to `false`, which restricts access. You can check its value via a `GET` request:
22+
23+
`GET https://graph.microsoft.com/v1.0/policies/authorizationPolicy`
24+
25+
## Solution
26+
27+
To resolve this issue, set the value of the `allowedToReadOtherUser` property to `true` via a `PATCH` request as follows:
28+
29+
```msgraph
30+
PATCH https://graph.microsoft.com/v1.0/policies/authorizationPolicy
31+
{
32+
"defaultUserRolePermissions": {
33+
"allowedToReadOtherUsers": true
34+
}
35+
}
36+
37+
[!INCLUDE [Azure Help Support](../../../includes/azure-help-support.md)]

0 commit comments

Comments
 (0)