Microsoft Azure Integration

Microsoft Azure provides alerts based on monitoring metrics for, or events on, services. Azure generates alerts for detected problems, and Opsgenie ensures the right people are working on them.

For an alert rule on a metric value, when the value of a specified metric crosses a threshold assigned, the alert rule becomes active and sends a notification. For an alert rule on events, a rule can send a notification on every event, or, only when a certain number of events happen.

​What does Opsgenie offer Azure users?

Azure generates alerts based on metrics and events. Opsgenie acts as a dispatcher for the alerts generated by Azure. Opsgenie determines the right people to notify based on on-call schedules and escalations and notifies via using email, text messages (SMS), phone calls, and Android & iOS push notifications.

Functionality of the integration

When an alert is created in Azure, an alert is created in Opsgenie automatically through the integration.

Add Azure integration in Opsgenie

  1. Please create an Opsgenie account if you haven't done so already.
  2. Go to Opsgenie's Azure Integration page.

For Free and Essentials plans, you can only add the integrations from the Team Dashboards, please use the alternative instructions given below to add this integration.

  1. Specify who is notified of Microsft Azure alerts using the Teams field. Auto-complete suggestions are provided as you type.

An alternative for Step 2) and Step 3) is to add the integration from the Team Dashboard of the team which will own the integration. To add an integration directly to a team, navigate to the Team Dashboard and open Integrations tab. Click Add Integration and select the integration that you would like to add.

  1. Copy the integration URL.
  2. Click Save Integration.

Configuration in Azure

Note: Azure webhook alerts are only available via the Azure Preview Portal. If using the classic version, please use the Email integration.

  1. Log in to Azure portal.
  2. Select Alerts (Classic) under the "MONITORING" section. The text and icon may vary slightly for different resources. If Alerts (Classic) is not easily found, they might be found under "Alerts" or "Alert Rules".
  1. Select the Add metric alert (classic) command and fill in the fields.
  2. Paste the URL from Opsgenie Azure integration into the Webhook field and save the rule.

Sample payload sent from Azure (Classic)

Create Alert payload:

{
  "status": "Activated",
  "context": {
    "id": "/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.insights/alertrules/Alert_1_runscope12",
    "name": "Alert_1_runscope12",
    "description": "desc",
    "conditionType": "Metric",
    "condition": {
      "metricName": "Memory available",
      "metricUnit": "Bytes",
      "metricValue": "1032190976",
      "threshold": "2",
      "windowSize": "5",
      "timeAggregation": "Average",
      "operator": "GreaterThan"
    },
    "subscriptionId": "1a66ce04-b633-4a0b-b2bc-a912ec8986a6",
    "resourceGroupName": "montest",
    "timestamp": "2015-09-18T01:02:35.8190994Z",
    "resourceName": "helixtest1",
    "resourceType": "microsoft.compute/virtualmachines",
    "resourceId": "/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/Microsoft.Compute/virtualMachines/Helixtest1",
    "resourceRegion": "centralus",
    "portalLink": "http://portallink.com"
  },
  "properties": {
    "hello1": "World1!",
    "json_stuff": {
      "type": "critical",
      "color": "red"
    },
    "customId": "wd39ue9832ue9iuhd9iuewhd9edh",
    "send_emails_to": "someone@somewhere.com"
  }
}

This payload is parsed by Opsgenie as:

{
  "status": "Activated",
  "id": "/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.insights/alertrules/Alert_1_runscope12",
  "name": "Alert_1_runscope12",
  "description": "desc",
  "condition_type": "Metric",
  "condition_metric_name": "Memory available",
  "condition_metric_unit": "Bytes",
  "condition_metric_value": "1032190976",
  "condition_threshold": "2",
  "condition_window_size": "5",
  "condition_time_aggregation": "Average",
  "condition_operator": "GreaterThan",
  "subscription_id": "1a66ce04-b633-4a0b-b2bc-a912ec8986a6",
  "resource_group_name": "montest",
  "timestamp": "2015-09-18T01:02:35.8190994Z",
  "resource_name": "helixtest1",
  "resource_type": "microsoft.compute/virtualmachines",
  "resource_id": "/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/Microsoft.Compute/virtualMachines/Helixtest1",
  "resource_region": "centralus",
  "portal_link": "http://portallink.com"
}

Opsgenie Supports the new Azure metric alerts as well:

With the Azure new metric alerts, new fields are added in the new Azure payload. Hence, you can accordingly configure the Opsgenie integration to support them.
For more info visit: https://docs.microsoft.com/en-us/azure/monitoring-and-diagnostics/monitoring-near-real-time-metric-alerts#payload-schema

Sample payload sent from Azure (New)

Create Alert payload:

{"schemaId":"AzureMonitorMetricAlert","data":
{
  "version": "2.0",
  "status": "Activated",
  "context": {
    "timestamp": "2018-02-28T10:44:10.1714014Z",
    "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Contoso/providers/microsoft.insights/metricAlerts/StorageCheck",
    "name": "StorageCheck",
    "description": "",
    "conditionType": "SingleResourceMultipleMetricCriteria",
    "condition": {
      "windowSize": "PT5M",
      "allOf": [
        {
          "metricName": "Transactions",
          "dimensions": [
            {
              "name": "AccountResourceId",
              "value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Contoso/providers/Microsoft.Storage/storageAccounts/diag500"
            },
            {
              "name": "GeoType",
              "value": "Primary"
            }
          ],
          "operator": "GreaterThan",
          "threshold": "0",
          "timeAggregation": "PT5M",
          "metricValue": 1.0
        }
      ]
    },
    "subscriptionId": "00000000-0000-0000-0000-000000000000",
    "resourceGroupName": "Contoso",
    "resourceName": "diag500",
    "resourceType": "Microsoft.Storage/storageAccounts",
    "resourceId": "/subscriptions/1e3ff1c0-771a-4119-a03b-be82a51e232d/resourceGroups/Contoso/providers/Microsoft.Storage/storageAccounts/diag500",
    "portalLink": "https://portal.azure.com/#resource//subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Contoso/providers/Microsoft.Storage/storageAccounts/diag500"
  },
  "properties": {
    "key1": "value1",
    "key2": "value2"
  }
}
}

This payload is parsed by Opsgenie as:

{
  "schemaId": "AzureMonitorMetricAlert",
  "version": "2.0",
  "status": "Activated",
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Contoso/providers/microsoft.insights/metricAlerts/StorageCheck",
  "name": "StorageCheck",
  "description": "",
  "condition_type": "SingleResourceMultipleMetricCriteria",
  "condition_metric_name": "Transactions",
  "condition_dimensions" : "[{name=AccountResourceId, value=/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Contoso/providers/Microsoft.Storage/storageAccounts/diag500}, {name=GeoType, value=Primary}]",
  "condition_metric_value": "1.0",
  "condition_threshold": "0",
  "condition_window_size": "PT5M",
  "condition_time_aggregation": "PT5M",
  "condition_operator": "GreaterThan",
  "subscription_id": "00000000-0000-0000-0000-000000000000",
  "resource_group_name": "Contoso",
  "timestamp": "2018-02-28T10:44:10.1714014Z",
  "resource_name": "diag500",
  "resource_type": "Microsoft.Storage/storageAccounts",
  "resource_id": "/subscriptions/1e3ff1c0-771a-4119-a03b-be82a51e232d/resourceGroups/Contoso/providers/Microsoft.Storage/storageAccounts/diag500",
  "portal_link": "https://portal.azure.com/#resource//subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Contoso/providers/Microsoft.Storage/storageAccounts/diag500"
}

Sample alert

Microsoft Azure Integration


Microsoft Azure provides alerts based on monitoring metrics for, or events on, services. Azure generates alerts for detected problems, and Opsgenie ensures the right people are working on them.

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.