首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Defender 365 REST API (您没有访问资源所需的任何应用程序权限(Incident.ReadWrite.All、Incident.Read.All) )

Defender 365 REST API (您没有访问资源所需的任何应用程序权限(Incident.ReadWrite.All、Incident.Read.All) )
EN

Stack Overflow用户
提问于 2021-08-16 14:49:44
回答 1查看 117关注 0票数 1

我正在尝试从Defender 365 (MDATP)下载事件列表。

我有一个获取不记名令牌的脚本:

代码语言:javascript
复制
. 'Functions\Credentials.ps1'

Function GET_BEARER_TOKEN_FOR_MDATP_AUTHENTICATION {

    $Body = [Ordered] @{
        resource      = "$ResourceApplicationIdUri"
        client_id     = "$ApplicationId"
        client_secret = "$ApplicationSecret"
        grant_type    = 'client_credentials'
    }

    try {
        $Response = Invoke-RestMethod -Method Post -Uri $OAuthenticationURI -Body $body -ErrorAction Stop
    }
    catch {
        Write-Output("unable to get the bearer token") 
        Exit
    }  
    $BearerToken = $Response.access_token
    
    return $BearerToken
}

$xx = GET_BEARER_TOKEN_FOR_MDATP_AUTHENTICATION
$xx | Out-File '.\Bearer_Token.txt'

这个脚本运行得很好。今天,我被授予了显示事件的权限。

当我尝试这样做时,我得到了错误消息:

代码语言:javascript
复制
{
    "error": {
        "code": "Forbidden",
        "message": "The application does not have any of the required application permissions (Incident.ReadWrite.All, Incident.Read.All) to access the resource.",
 }
}

当我登录令牌测试器网站时:https://jwt.ms/

我看不到这些incident.Read.All角色,只能看到:

代码语言:javascript
复制
  "roles": [
    "Alert.ReadWrite.All",
    "AdvancedQuery.Read.All"
  ]

本说明书中给出了以下角色:

https://docs.microsoft.com/en-us/microsoft-365/security/defender/api-create-app-web?view=o365-worldwide

非常感谢,艾斯特

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-08-17 08:20:35

所以我找到了问题所在:

$ResourceApplicationIdUri = 'https://api.securitycenter.microsoft.com‘(允许警报) $ResourceApplicationIdUri = 'https://api.security.microsoft.com’(允许事件)

致敬,艾斯特

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68804880

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档