创建对 security/alerts 的 Microsoft Graph webhook 订阅失败

Creating a Microsoft Graph webhook subscription to security/alerts fails

当我尝试创建对 security/alerts 端点的 Microsoft Graph webhook 订阅时,订阅创建失败并显示一条通用消息,如下所示。将资源修改为 'me/messages' 会导致成功创建 webhook 订阅,因此这似乎特定于 security/alerts 端点。我该如何解决这个问题?

请求正文如下:

{
  "changeType": "created",
  "notificationUrl": "https://xxxxxxxxx.azurewebsites.net/api/graphnotifications",
  "resource": "security/alerts?$filter=vendorInformation/provider+eq+'ASC'",
  "expirationDateTime": "2018-11-15T11:00:00.0000000Z",
  "clientState": "secretClientValue"
}

Wes,您没有 post 您向其发送该请求的 URL。根据安全警报文档。

You can use Microsoft Graph webhooks to subscribe to and receive notifications about updates to Microsoft Graph Security entities.

https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/resources/security-api-overview

在该页面上,它说明了 post 请求并给出了这样的示例

POST https://graph.microsoft.com/v1.0/subscriptions
Content-Type: application/json
{
  "changeType": "created,updated",
  "notificationUrl": "https://webhook.azurewebsites.net/notificationClient",
  "resource": "/me/mailfolders('inbox')/messages",
  "expirationDateTime": "2016-03-20T11:00:00.0000000Z",
  "clientState": "SecretClientState"
}

https://developer.microsoft.com/en-us/graph/docs/concepts/webhooks

您是否post将请求正文发送到 url?

'changeType'请使用'updated'。 Security/Alerts 使用 'updated' 用于所有新的或更新的警报。