Skip to content

Commit c422c90

Browse files
author
Simonx Xu
authored
Merge pull request #9066 from AmandaAZ/Branch-CI5826
AB#5826: Convert blog post to article
2 parents db69245 + 6aa58c4 commit c422c90

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

support/entra/entra-id/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,8 @@
303303
href: app-integration/404-not-found-error-manage-objects-microsoft-graph.md
304304
- name: Change enumeration is not supported for requested tenant
305305
href: users-groups-entra-apis/delta-query-not-supported-for-aad-b2c-tenant.md
306+
- name: Graph API request fails to get B2B users using UPN
307+
href: users-groups-entra-apis/microsoft-graph-api-query-can-not-get-business-to-business-user.md
306308
- name: Handling errors in Graph API requests with Invoke-RestMethod
307309
href: app-integration/graph-api-error-handling-invoke-restmethod.md
308310
- name: Only one user is returned when running List users API
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
title: Microsoft Graph API Requests Fail to Get B2B Users Using UPN
3+
description: Provides a solution to an issue where a Microsoft Graph API request fails to get a Business-to-Business (B2B) user using User Principal Name (UPN).
4+
ms.service: entra-id
5+
ms.reviewer: bhvootla, v-weizhu
6+
ms.custom: sap:Problem with querying or provisioning resources
7+
ms.date: 06/23/2025
8+
---
9+
# Microsoft Graph API requests fail to get B2B users using UPN
10+
11+
This article provides a solution to an error that occurs when you run a Microsoft Graph API request to get a Business-to-Business (B2B) user using User Principal Name (UPN).
12+
13+
## Symptoms
14+
15+
When you execute a Microsoft Graph API request to get a B2B user using UPN, you might encounter an error.
16+
17+
Request example:
18+
19+
`https://graph.microsoft.com/v1.0/users/example_gmail.com#EXT#@example.onmicrosoft.com`
20+
21+
Response exmaple:
22+
23+
```output
24+
{
25+
"error": {
26+
"code": "Request_ResourceNotFound",
27+
"message": "Resource '<resource-id>' does not exist or one of its queried reference-property objects are not present.",
28+
"innerError": {
29+
"request-id": "<request-id>",
30+
"date": "2019-12-05T23:55:40"
31+
}
32+
}
33+
}
34+
```
35+
36+
## Cause
37+
38+
The issue occurs because the `#` character in the UPN is treated as a special character in the URL. Everything after the `#` is treated as a fragment and isn't sent over the wire.
39+
40+
## Solution
41+
42+
To resolve this issue, you must encode the `#` character in the UPN as `%23`.
43+
44+
Here's the correct request format:
45+
46+
`https://graph.microsoft.com/v1.0/users/example_gmail.com%23EXT%[email protected]`
47+
48+
[!INCLUDE [Azure Help Support](../../../includes/azure-help-support.md)]

0 commit comments

Comments
 (0)