Webhooks for Azure activity log alerts

As part of the definition of an action group, you can configure webhook endpoints to receive activity log alert notifications. With webhooks, you can route these notifications to other systems for post-processing or custom actions. This article shows what the payload for the HTTP POST to a webhook looks like.

For more information on activity log alerts, see how to create Azure activity log alerts.

For information on action groups, see how to create action groups.

Authenticate the webhook

The webhook can optionally use token-based authorization for authentication. The webhook URI is saved with a token ID, for example, https://mysamplealert/webcallback?tokenid=sometokenid&someparameter=somevalue.

Payload schema

The JSON payload contained in the POST operation differs based on the payload's data.context.activityLog.eventSource field.

Common

{
    "schemaId": "Microsoft.Insights/activityLogs",
    "data": {
        "status": "Activated",
        "context": {
            "activityLog": {
                "channels": "Operation",
                "correlationId": "6ac88262-43be-4adf-a11c-bd2179852898",
                "eventSource": "Administrative",
                "eventTimestamp": "2017-03-29T15:43:08.0019532+00:00",
                "eventDataId": "8195a56a-85de-4663-943e-1a2bf401ad94",
                "level": "Informational",
                "operationName": "Microsoft.Insights/actionGroups/write",
                "operationId": "6ac88262-43be-4adf-a11c-bd2179852898",
                "status": "Started",
                "subStatus": "",
                "subscriptionId": "52c65f65-0518-4d37-9719-7dbbfc68c57a",
                "submissionTimestamp": "2017-03-29T15:43:20.3863637+00:00",
                ...
            }
        },
        "properties": {}
    }
}

Administrative

{
    "schemaId": "Microsoft.Insights/activityLogs",
    "data": {
        "status": "Activated",
        "context": {
            "activityLog": {
                "authorization": {
                    "action": "Microsoft.Insights/actionGroups/write",
                    "scope": "/subscriptions/52c65f65-0518-4d37-9719-7dbbfc68c57b/resourceGroups/CONTOSO-TEST/providers/Microsoft.Insights/actionGroups/IncidentActions"
                },
                "claims": "{...}",
                "caller": "me@contoso.com",
                "description": "",
                "httpRequest": "{...}",
                "resourceId": "/subscriptions/52c65f65-0518-4d37-9719-7dbbfc68c57b/resourceGroups/CONTOSO-TEST/providers/Microsoft.Insights/actionGroups/IncidentActions",
                "resourceGroupName": "CONTOSO-TEST",
                "resourceProviderName": "Microsoft.Insights",
                "resourceType": "Microsoft.Insights/actionGroups"
            }
        },
        "properties": {}
    }
}

ServiceHealth

{
    "schemaId": "unknown",
    "data": {
        "status": "Activated",
        "context": {
            "activityLog": {
                "properties": {
                    "title": "...",
                    "service": "...",
                    "region": "...",
                    "communication": "...",
                    "incidentType": "Incident",
                    "trackingId": "...",
                    "groupId": "...",
                    "impactStartTime": "3/29/2017 3:43:21 PM",
                    "impactMitigationTime": "3/29/2017 3:43:21 PM",
                    "eventCreationTime": "3/29/2017 3:43:21 PM",
                    "impactedServices": "[{...}]",
                    "defaultLanguageTitle": "...",
                    "defaultLanguageContent": "...",
                    "stage": "Active",
                    "communicationId": "...",
                    "version": "0.1"
                }
            }
        },
        "properties": {}
    }
}

For specific schema details on service health notification activity log alerts, see Service health notifications.

For specific schema details on all other activity log alerts, see Overview of the Azure activity log.

Element name Description
status Used for metric alerts. Always set to "activated" for activity log alerts.
context Context of the event.
resourceProviderName The resource provider of the impacted resource.
conditionType Always "Event."
name Name of the alert rule.
id Resource ID of the alert.
description Alert description set when the alert is created.
subscriptionId Azure subscription ID.
timestamp Time at which the event was generated by the Azure service that processed the request.
resourceId Resource ID of the impacted resource.
resourceGroupName Name of the resource group for the impacted resource.
properties Set of <Key, Value> pairs (that is, Dictionary<String, String>) that includes details about the event.
event Element that contains metadata about the event.
authorization The Role-Based Access Control properties of the event. These properties usually include the action, the role, and the scope.
category Category of the event. Supported values include Administrative, Alert, Security, ServiceHealth, and Recommendation.
caller Email address of the user who performed the operation, UPN claim, or SPN claim based on availability. Can be null for certain system calls.
correlationId Usually a GUID in string format. Events with correlationId belong to the same larger action and usually share a correlationId.
eventDescription Static text description of the event.
eventDataId Unique identifier for the event.
eventSource Name of the Azure service or infrastructure that generated the event.
httpRequest The request usually includes the clientRequestId, clientIpAddress, and HTTP method (for example, PUT).
level One of the following values: Critical, Error, Warning, Informational, and Verbose.
operationId Usually a GUID shared among the events corresponding to single operation.
operationName Name of the operation.
properties Properties of the event.
status String. Status of the operation. Common values include Started, In Progress, Succeeded, Failed, Active, and Resolved.
subStatus Usually includes the HTTP status code of the corresponding REST call. It might also include other strings that describe a substatus. Common substatus values include OK (HTTP Status Code: 200), Created (HTTP Status Code: 201), Accepted (HTTP Status Code: 202), No Content (HTTP Status Code: 204), Bad Request (HTTP Status Code: 400), Not Found (HTTP Status Code: 404), Conflict (HTTP Status Code: 409), Internal Server Error (HTTP Status Code: 500), Service Unavailable (HTTP Status Code: 503), and Gateway Timeout (HTTP Status Code: 504).

Next steps