大网数据广告活动
域与目录服务

HTTP 403 Authorization Error When Calling Microsoft Graph Security API

· 52CE 我爱测

Provides solutions to an HTTP 403 error that occurs when you call the Microsoft Graph Security API.

This article provides solutions to an HTTP 403 error that occurs when you call the Microsoft Graph Security API.

Symptoms

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:

Auth token does not contain valid permissions or user does not have valid roles

Cause

The error occurs due to one of the following reasons:

  • The access token lacks the necessary Microsoft Graph permissions for the security endpoints.
  • The authenticating user that obtains the access token doesn't have a Microsoft Entra admin role required for the delegated permission type token.

Solution 1: Use valid Microsoft Graph permissions

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.

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:

Permission Entity Supported requests
SecurityActions.Read.All • securityActions (preview) GET
SecurityActions.ReadWrite.All • securityActions (preview) GET, POST
SecurityEvents.Read.All • alerts • secureScores • secureScoreControlProfiles GET
SecurityEvents.ReadWrite.All • alerts • secureScores • secureScoreControlProfiles GET, POST, PATCH
ThreatIndicators.ReadWrite.OwnedBy • tiIndicator (preview) GET, POST, PATCH, DELETE

For more information, see Use the Microsoft Graph security API and Microsoft Graph permissions reference.

Solution 2: Use valid Microsoft Entra admin roles

For delegated permission tokens, the authenticating user needs to have one of the following admin roles:

Microsoft Entra role Role template ID
Security Reader 5d6b6bb7-de71-4623-b4af-96380a352509
Security Administrator 194ae4cb-b126-40b2-bd5b-6091b380977d
Global Administrator 62e90394-69f5-4237-9190-012177145e10

For more information, see Microsoft Entra built-in roles and Authorization and the Microsoft Graph Security API.

The wids claim in the token contains the Microsoft Entra role. It can be used to determine whether the user has sufficient privileges.

"ver": "1.0"
"wids": [
   "62e90394-69f5-4237-9190-012177145e10",
   "b79fbf4d-3ef9-4689-8143-76b194e85509"
],
"xms_st":{
  "sub": "<sub>"
}

Note: If the token is obtained via the implicit grant flow, the wids claim might not exist. For more information, see Access tokens in the Microsoft identity platform. In this case, use a different OAuth 2 grant flow, such as the authorization code flow, to obtain the access token.

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.

资料来源与适用范围

资料来源
Microsoft Learn / IT Pro troubleshooting
适用范围
See source applicability · Source date 05/14/2025
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。