Skip to content

Commit 97b5c4c

Browse files
committed
AB#4675: and Entra APIs Getting access denied errors (Authorization)
1 parent 5af69eb commit 97b5c4c

2 files changed

Lines changed: 61 additions & 0 deletions

File tree

support/entra/entra-id/toc.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,10 @@
277277
href: app-integration/404-not-found-error-manage-objects-microsoft-graph.md
278278
- name: Use managed identities to call Graph APIs in VB.Net and C#
279279
href: users-groups-entra-apis/call-graph-api-using-managed-dentities.md
280+
- name: Getting access denied errors (Authorization)
281+
items:
282+
- name: Error "The identity of the calling application could not be established"
283+
href: users-groups-entra-apis/identity-of-calling-application-not-established.md
280284
- name: Microsoft Entra User Provisioning and Synchronization
281285
items:
282286
- name: User Sign-in or password Problems
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
title: The identity of the calling application could not be established
3+
description: Provides a solution to the error "The identity of the calling application could not be established" when using Microsoft Graph.
4+
ms.date: 03/28/2025
5+
ms.service: entra-id
6+
ms.custom: sap:Getting access denied errors (Authorization)
7+
ms.reviewer: willfid, v-weizhu
8+
---
9+
# Error "The identity of the calling application could not be established"
10+
11+
This article provides a solution to the error message "The identity of the calling application could not be established" when using Microsoft Graph.
12+
13+
## Symptoms
14+
15+
When using Microsoft Graph or some services that rely on it, you encounter the following error message:
16+
17+
> The identity of the calling application could not be established
18+
19+
## Cause
20+
21+
This error occurs because the `oid` and `sub` claims are missing from the access token. The root cause is that the service principal doesn't exist in the tenant or the tenant isn't aware of the application.
22+
23+
## Solution for Partner scenario
24+
25+
If the application is a Partner application, ensure that you complete the Partner pre-consent process. For more information, see [Partner pre-consent](https://github.com/microsoft/Partner-Center-Explorer/blob/master/docs/Preconsent.md) and add your application or service principal to the AdminAgents group.
26+
27+
Here's an updated PowerShell script for using Microsoft Graph:
28+
29+
```powershell
30+
Connect-MgGraph
31+
32+
$AppId = '<Application ID>'
33+
34+
$g = Get-MgGroup -All -Filter "displayName eq 'AdminAgents'"
35+
36+
$s = Get-MgServicePrincipal -All -Filter "appId eq '$AppId'"
37+
38+
$params = @{
39+
"@odata.id" = "https://graph.microsoft.com/v1.0/directoryObjects/$($s.id)"
40+
}
41+
42+
New-MgGroupMemberByRef -GroupId $g.id -BodyParameter $params
43+
```
44+
45+
Ensure that you replace `<Application ID>` with your application's actual Application ID.
46+
47+
## Solution for Non-Partner scenario
48+
49+
If this isn't a Partner application, add the service principal to the tenant and consent to the permissions required by the application.
50+
51+
You can [build an admin consent URL](/entra/identity/enterprise-apps/grant-admin-consent?pivots=portal#construct-the-url-for-granting-tenant-wide-admin-consent) like the following one:
52+
53+
`https://login.microsoftonline.com/{organization}/adminconsent?client_id={client-id}`
54+
55+
Then, sign in with a Global Administrator account of the tenant where you are trying to access resources.
56+
57+
[!INCLUDE [Azure Help Support](../../../includes/azure-help-support.md)]

0 commit comments

Comments
 (0)