Create comment for alert

Namespace: microsoft.graph

Create a comment for an existing alert based on the specified alert id property.

This API is available in the following national cloud deployments.

Global service US Government L4 US Government L5 (DOD) China operated by 21Vianet

Permissions

Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.

Permission type Least privileged permissions Higher privileged permissions
Delegated (work or school account) SecurityAlert.ReadWrite.All Not available.
Delegated (personal Microsoft account) Not supported. Not supported.
Application SecurityAlert.ReadWrite.All Not available.

HTTP request

POST /security/alerts_v2/{alertId}/comments

Request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.
Content-Type application/json. Required.

Request body

In the request body, use @odata.type to specify the parameter type of alertComment, and provide a JSON object for the parameter, comment. See an example.

Parameter Type Description
comment String The comment to be added.

Response

If successful, this method returns a 200 OK response code and an updated list of all alertComment resources for the specified alert.

Examples

Request

The following example shows a request.

POST https://graph.microsoft.com/v1.0/security/alerts_v2/da637865765418431569_-773071023/comments
Content-Type: application/json

{
    "@odata.type": "microsoft.graph.security.alertComment",
    "comment": "Demo for docs"
}

Response

The following example shows the response.

Note: The response object shown here might be shortened for readability.

HTTP/1.1 200 OK
Content-type: application/json

{
    "@odata.context": "https://graph.microsoft.com/beta/$metadata#security/alerts_v2('da637865765418431569_-773071023')/comments",
    "value": [
        {
            "comment": "test",
            "createdByDisplayName": "[email protected]",
            "createdDateTime": "2022-10-13T07:08:30.1606766Z"
        },
        {
            "comment": "Demo for docs",
            "createdByDisplayName": "[email protected]",
            "createdDateTime": "2022-10-13T07:08:40.3825324Z"
        }
    ]
}