我正在尝试使用基于Azure哨兵建议的Microsoft graph API威胁指示器API,该方法将用于IOC接收的威胁情报源集成到Sentinel实例。我在linux curl中执行以下步骤来测试功能:
使用以下方法从Microsoft获取OAuth令牌:
curl -X POST -d 'grant_type=client_credentials&client_id=[myClientId]&client_secret=[myAppSecret]&scope=openid profile ThreatIndicators.ReadWrite.OwnedBy' https://login.microsoftonline.com/[myTenantId]/oauth2/token
使用接收到的承载令牌调用以下API:curl -X GET -H "Authorization: Bearer [access token]" https://graph.microsoft.com/beta/security/tiIndicators
我收到以下提到的错误:
{
"error": {
"code": "InvalidAuthenticationToken",
"message": "Access token validation failure. Invalid audience.",
"innerError": {
"request-id": "########################",
"date": "2019-12-19T07:41:51"
}
}
任何人都有Idea的用法吗?主要动机是使用图形API POST查询在Azure Sentinel中插入威胁指示符
答案 0 :(得分:0)
在请求正文中为V1.0令牌端点使用resource
而不是scope
。
curl -X POST -d 'grant_type=client_credentials&client_id=[myClientId]&client_secret=[myAppSecret]&resource=https://graph.microsoft.com' https://login.microsoftonline.com/[myTenantId]/oauth2/token
OR (如下所示的V2.0令牌端点)
curl -X POST -d 'grant_type=client_credentials&client_id=[myClientId]&client_secret=[myAppSecret]&scope=https://graph.microsoft.com/.default' https://login.microsoftonline.com/[myTenantId]/oauth2/v2.0/token