Skip to content

Commit b049acb

Browse files
author
Simonx Xu
authored
Merge pull request #8868 from AmandaAZ/Branch-CI5505
AB#5505: Convert blog post to article
2 parents 54662d7 + d4c0e30 commit b049acb

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed

support/entra/entra-id/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,8 @@
309309
href: users-groups-entra-apis/add-owner-for-application-microsoft-graph.md
310310
- name: NoPermissionsInAccessToken when calling me endpoint
311311
href: users-groups-entra-apis/error-call-me-endpoint-microsoft-graph.md
312+
- name: HTTP 403 authorization error when calling Microsoft Graph Security API
313+
href: users-groups-entra-apis/403-error-when-calling-microsoft-graph-security-api.md
312314
- name: Tenant doesn't have premium license error when query sign-in activities
313315
href: users-groups-entra-apis/b2c-or-tenant-premium-license-sign-in-activities.md
314316
- name: Problem with using the Graph SDK - libraries
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
title: HTTP 403 Authorization Error When Calling Microsoft Graph Security API
3+
description: Provides solutions to an HTTP 403 error that occurs when you call the Microsoft Graph Security API.
4+
ms.date: 05/14/2025
5+
ms.service: entra-id
6+
ms.custom: sap:Getting access denied errors (Authorization)
7+
ms.reviewer: bachoang, v-weizhu
8+
---
9+
# HTTP 403 authorization error when calling the Microsoft Graph Security API
10+
11+
This article provides solutions to an HTTP 403 error that occurs when you call the Microsoft Graph Security API.
12+
13+
## Symptoms
14+
15+
When using the Microsoft Graph Security API to call endpoints such as `https://graph.microsoft.com/v1.0/security/alert` and `https://graph.microsoft.com/beta/security/secoreScores`, you might receive a 403 error with the following message:
16+
17+
> Auth token does not contain valid permissions or user does not have valid roles
18+
19+
## Cause
20+
21+
The error occurs due to one of the following reasons:
22+
23+
- The access token lacks the necessary Microsoft Graph permissions for the security endpoints.
24+
- The authenticating user that obtains the access token doesn't have a Microsoft Entra admin role required for the delegated permission type token.
25+
26+
## Solution 1: Use valid Microsoft Graph permissions
27+
28+
There are two types of tokens: application and delegated permission tokens. For more information, see [Application and delegated permissions for access tokens in the Microsoft identity platform](../app-integration/application-delegated-permission-access-tokens-identity-platform.md).
29+
30+
For delegated permission tokens, the Microsoft Graph permissions are in the `scp` claim. For application permission tokens, the permissions are in the `roles` claim. To get the required Microsoft Graph permissions, you can refer to the following table, which is also listed in [Authorization and the Microsoft Graph Security API](/graph/security-authorization#register-an-application-with-the-microsoft-identity-platform-endpoint):
31+
32+
|Permission | Entity | Supported requests |
33+
|:----------|:-------|:-------------------|
34+
|SecurityActions.Read.All| • [securityActions](/graph/api/resources/securityaction) (preview) | GET |
35+
|SecurityActions.ReadWrite.All| • [securityActions](/graph/api/resources/securityaction) (preview) | GET, POST |
36+
|SecurityEvents.Read.All | &bull; [alerts](/graph/api/resources/alert)</br> &bull; [secureScores](/graph/api/resources/securescore) </br> &bull; [secureScoreControlProfiles](/graph/api/resources/securescorecontrolprofiles) | GET |
37+
|SecurityEvents.ReadWrite.All | &bull; [alerts](/graph/api/resources/alert)</br> &bull; [secureScores](/graph/api/resources/securescore) </br> &bull; [secureScoreControlProfiles](/graph/api/resources/securescorecontrolprofiles) | GET, POST, PATCH |
38+
|ThreatIndicators.ReadWrite.OwnedBy | &bull; [tiIndicator](/graph/api/resources/tiindicator) (preview) | GET, POST, PATCH, DELETE|
39+
40+
For more information, see [Use the Microsoft Graph security API](/graph/api/resources/security-api-overview) and [Microsoft Graph permissions reference](/graph/permissions-reference).
41+
42+
## Solution 2: Use valid Microsoft Entra admin roles
43+
44+
For delegated permission tokens, the authenticating user needs to have one of the following admin roles:
45+
46+
|Microsoft Entra role|Role template ID|
47+
|---|---|
48+
|Security Reader|5d6b6bb7-de71-4623-b4af-96380a352509|
49+
|Security Administrator|194ae4cb-b126-40b2-bd5b-6091b380977d|
50+
|Global Administrator|62e90394-69f5-4237-9190-012177145e10|
51+
52+
For more information, see [Microsoft Entra built-in roles](/entra/identity/role-based-access-control/permissions-reference) and [Authorization and the Microsoft Graph Security API](/graph/security-authorization).
53+
54+
The `wids` claim in the token contains the Microsoft Entra role. It can be used to determine whether the user has sufficient privileges.
55+
56+
```json
57+
"ver": "1.0"
58+
"wids": [
59+
"62e90394-69f5-4237-9190-012177145e10",
60+
"b79fbf4d-3ef9-4689-8143-76b194e85509"
61+
],
62+
"xms_st":{
63+
"sub": "<sub>"
64+
}
65+
```
66+
67+
> [!NOTE]
68+
> If the token is obtained via the [implicit grant flow](/entra/identity-platform/v2-oauth2-implicit-grant-flow), the `wids` claim might not exist. For more information, see [Access tokens in the Microsoft identity platform](/entra/identity-platform/access-tokens). In this case, use a different OAuth 2 grant flow, such as the [authorization code flow](/entra/identity-platform/v2-oauth2-auth-code-flow), to obtain the access token.
69+
70+
[!INCLUDE [Azure Help Support](../../../includes/azure-help-support.md)]

0 commit comments

Comments
 (0)