Action Groups - Post Test Notifications

Send test notifications to a set of provided receivers

POST https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Insights/createNotifications?api-version=2021-09-01

URI Parameters

Name In Required Type Description
subscriptionId
path True

string

The ID of the target subscription.

api-version
query True

string

The API version to use for this operation.

Request Body

Name Required Type Description
alertType True

string

The value of the supported alert type. Supported alert type values are: servicehealth, metricstaticthreshold, metricsdynamicthreshold, logalertv2, smartalert, webtestalert, logalertv1numresult, logalertv1metricmeasurement, resourcehealth, activitylog, actualcostbudget, forecastedbudget

armRoleReceivers

ArmRoleReceiver[]

The list of ARM role receivers that are part of this action group. Roles are Azure RBAC roles and only built-in roles are supported.

automationRunbookReceivers

AutomationRunbookReceiver[]

The list of AutomationRunbook receivers that are part of this action group.

azureAppPushReceivers

AzureAppPushReceiver[]

The list of AzureAppPush receivers that are part of this action group.

azureFunctionReceivers

AzureFunctionReceiver[]

The list of azure function receivers that are part of this action group.

emailReceivers

EmailReceiver[]

The list of email receivers that are part of this action group.

eventHubReceivers

EventHubReceiver[]

The list of event hub receivers that are part of this action group.

itsmReceivers

ItsmReceiver[]

The list of ITSM receivers that are part of this action group.

logicAppReceivers

LogicAppReceiver[]

The list of logic app receivers that are part of this action group.

smsReceivers

SmsReceiver[]

The list of SMS receivers that are part of this action group.

voiceReceivers

VoiceReceiver[]

The list of voice receivers that are part of this action group.

webhookReceivers

WebhookReceiver[]

The list of webhook receivers that are part of this action group.

Responses

Name Type Description
200 OK

TestNotificationDetailsResponse

The notification succeeded

202 Accepted

The notification request accepted

Headers

location: string

Other Status Codes

ErrorResponse

An error occurred while sending the test notifications

Security

azure_auth

Azure Active Directory OAuth2 Flow

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

Create notifications at subscription level

Sample Request

POST https://management.azure.com/subscriptions/187f412d-1758-44d9-b052-169e2564721d/providers/Microsoft.Insights/createNotifications?api-version=2021-09-01

{
  "alertType": "budget",
  "emailReceivers": [
    {
      "name": "John Doe's email",
      "emailAddress": "johndoe@email.com",
      "useCommonAlertSchema": false
    },
    {
      "name": "Jane Smith's email",
      "emailAddress": "janesmith@email.com",
      "useCommonAlertSchema": true
    }
  ],
  "smsReceivers": [
    {
      "name": "John Doe's mobile",
      "countryCode": "1",
      "phoneNumber": "1234567890"
    },
    {
      "name": "Jane Smith's mobile",
      "countryCode": "1",
      "phoneNumber": "0987654321"
    }
  ],
  "webhookReceivers": [
    {
      "name": "Sample webhook 1",
      "serviceUri": "http://www.example.com/webhook1",
      "useCommonAlertSchema": true
    },
    {
      "name": "Sample webhook 2",
      "serviceUri": "http://www.example.com/webhook2",
      "useCommonAlertSchema": true,
      "useAadAuth": true,
      "objectId": "d3bb868c-fe44-452c-aa26-769a6538c808",
      "identifierUri": "http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a",
      "tenantId": "68a4459a-ccb8-493c-b9da-dd30457d1b84"
    }
  ],
  "itsmReceivers": [
    {
      "name": "Sample itsm",
      "workspaceId": "5def922a-3ed4-49c1-b9fd-05ec533819a3|55dfd1f8-7e59-4f89-bf56-4c82f5ace23c",
      "connectionId": "a3b9076c-ce8e-434e-85b4-aff10cb3c8f1",
      "ticketConfiguration": "{\"PayloadRevision\":0,\"WorkItemType\":\"Incident\",\"UseTemplate\":false,\"WorkItemData\":\"{}\",\"CreateOneWIPerCI\":false}",
      "region": "westcentralus"
    }
  ],
  "azureAppPushReceivers": [
    {
      "name": "Sample azureAppPush",
      "emailAddress": "johndoe@email.com"
    }
  ],
  "automationRunbookReceivers": [
    {
      "automationAccountId": "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest",
      "runbookName": "Sample runbook",
      "webhookResourceId": "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest/webhooks/Alert1510184037084",
      "isGlobalRunbook": false,
      "name": "testRunbook",
      "serviceUri": "http://test.me",
      "useCommonAlertSchema": true
    }
  ],
  "voiceReceivers": [
    {
      "name": "Sample voice",
      "countryCode": "1",
      "phoneNumber": "1234567890"
    }
  ],
  "logicAppReceivers": [
    {
      "name": "Sample logicApp",
      "resourceId": "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/LogicApp/providers/Microsoft.Logic/workflows/testLogicApp",
      "callbackUrl": "https://prod-27.northcentralus.logic.azure.com/workflows/68e572e818e5457ba898763b7db90877/triggers/manual/paths/invoke/azns/test?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=Abpsb72UYJxPPvmDo937uzofupO5r_vIeWEx7KVHo7w",
      "useCommonAlertSchema": false
    }
  ],
  "azureFunctionReceivers": [
    {
      "name": "Sample azureFunction",
      "functionAppResourceId": "/subscriptions/5def922a-3ed4-49c1-b9fd-05ec533819a3/resourceGroups/aznsTest/providers/Microsoft.Web/sites/testFunctionApp",
      "functionName": "HttpTriggerCSharp1",
      "httpTriggerUrl": "http://test.me",
      "useCommonAlertSchema": true
    }
  ],
  "eventHubReceivers": [
    {
      "name": "Sample eventHub",
      "eventHubNameSpace": "testEventHubNameSpace",
      "eventHubName": "testEventHub",
      "subscriptionId": "187f412d-1758-44d9-b052-169e2564721d",
      "tenantId": "68a4459a-ccb8-493c-b9da-dd30457d1b84"
    }
  ],
  "armRoleReceivers": [
    {
      "name": "ArmRole-Common",
      "roleId": "11111111-1111-1111-1111-111111111111",
      "useCommonAlertSchema": true
    },
    {
      "name": "ArmRole-nonCommon",
      "roleId": "11111111-1111-1111-1111-111111111111",
      "useCommonAlertSchema": false
    }
  ]
}

Sample Response

location: https://management.azure.com/subscriptions/11111111-1111-1111-1111-111111111111/providers/microsoft.insights/notificationStatus/11111111111111?api-version=2022-06-01
{
  "context": {
    "notificationSource": "Microsoft.Insights/TestNotification",
    "contextType": "Microsoft.Insights/Budget"
  },
  "state": "Completed",
  "completedTime": "0001-01-01T00:00:00+00:00",
  "createdTime": "2021-09-21T04:52:29.5091168+00:00",
  "actionDetails": [
    {
      "MechanismType": "AzureAppPush",
      "Name": "AzureAppPush-name",
      "Status": "Completed",
      "SubState": "Default",
      "SendTime": "2021-09-21T04:52:42.8620629+00:00",
      "Detail": null
    },
    {
      "MechanismType": "AzureFunction",
      "Name": "AzureFunction-name",
      "Status": "Completed",
      "SubState": "Default",
      "SendTime": "2021-09-21T04:52:42.0623319+00:00",
      "Detail": null
    },
    {
      "MechanismType": "Email",
      "Name": "Email-name",
      "Status": "Completed",
      "SubState": "Default",
      "SendTime": "2021-09-21T04:52:40.7480368+00:00",
      "Detail": null
    },
    {
      "MechanismType": "LogicApp",
      "Name": "LogicApp-Name",
      "Status": "Completed",
      "SubState": "Default",
      "SendTime": "2021-09-21T04:52:42.2473419+00:00",
      "Detail": null
    },
    {
      "MechanismType": "Webhook",
      "Name": "Webhook-name",
      "Status": "Completed",
      "SubState": "Default",
      "SendTime": "2021-09-21T04:52:42.0723479+00:00",
      "Detail": null
    },
    {
      "MechanismType": "SecureWebhook",
      "Name": "SecureWebhook-name",
      "Status": "Completed",
      "SubState": "Default",
      "SendTime": "2021-09-21T04:52:42.0723479+00:00",
      "Detail": null
    },
    {
      "MechanismType": "Sms",
      "Name": "Sms-name",
      "Status": "Completed",
      "SubState": "Default",
      "SendTime": "2021-09-21T04:52:41.353015+00:00",
      "Detail": null
    },
    {
      "MechanismType": "Voice",
      "Name": "Voice-name",
      "Status": "Completed",
      "SubState": "Default",
      "SendTime": "2021-09-21T04:52:41.6330734+00:00",
      "Detail": null
    },
    {
      "MechanismType": "EventHub",
      "Name": "EventHub-name",
      "Status": "Completed",
      "SubState": "Default",
      "SendTime": "2021-09-21T04:52:42.0723479+00:00",
      "Detail": null
    },
    {
      "MechanismType": "AutomationRunbook",
      "Name": "AutomationRunbook-name",
      "Status": "Completed",
      "SubState": "Default",
      "SendTime": "2021-09-21T04:52:42.0723479+00:00",
      "Detail": null
    },
    {
      "MechanismType": "Itsm",
      "Name": "Itsm-name",
      "Status": "Completed",
      "SubState": "Default",
      "SendTime": "2021-09-21T04:52:42.0723479+00:00",
      "Detail": null
    }
  ]
}

Definitions

Name Description
ActionDetail

The action detail

ArmRoleReceiver

An arm role receiver.

AutomationRunbookReceiver

The Azure Automation Runbook notification receiver.

AzureAppPushReceiver

The Azure mobile App push notification receiver.

AzureFunctionReceiver

An azure function receiver.

Context

The context info

EmailReceiver

An email receiver.

ErrorResponse

Describes the format of Error response.

EventHubReceiver

An Event hub receiver.

ItsmReceiver

An Itsm receiver.

LogicAppReceiver

A logic app receiver.

NotificationRequestBody

The request body which contain contact detail metadata

ReceiverStatus

Indicates the status of the receiver. Receivers that are not Enabled will not receive any communications.

SmsReceiver

An SMS receiver.

TestNotificationDetailsResponse

The details of the test notification results.

VoiceReceiver

A voice receiver.

WebhookReceiver

A webhook receiver.

ActionDetail

The action detail

Name Type Description
Detail

string

The detail of the friendly error message

MechanismType

string

The mechanism type

Name

string

The name of the action

SendTime

string

The send time

Status

string

The status of the action

SubState

string

The substatus of the action

ArmRoleReceiver

An arm role receiver.

Name Type Default Value Description
name

string

The name of the arm role receiver. Names must be unique across all receivers within an action group.

roleId

string

The arm role id.

useCommonAlertSchema

boolean

False

Indicates whether to use common alert schema.

AutomationRunbookReceiver

The Azure Automation Runbook notification receiver.

Name Type Default Value Description
automationAccountId

string

The Azure automation account Id which holds this runbook and authenticate to Azure resource.

isGlobalRunbook

boolean

Indicates whether this instance is global runbook.

name

string

Indicates name of the webhook.

runbookName

string

The name for this runbook.

serviceUri

string

The URI where webhooks should be sent.

useCommonAlertSchema

boolean

False

Indicates whether to use common alert schema.

webhookResourceId

string

The resource id for webhook linked to this runbook.

AzureAppPushReceiver

The Azure mobile App push notification receiver.

Name Type Description
emailAddress

string

The email address registered for the Azure mobile app.

name

string

The name of the Azure mobile app push receiver. Names must be unique across all receivers within an action group.

AzureFunctionReceiver

An azure function receiver.

Name Type Default Value Description
functionAppResourceId

string

The azure resource id of the function app.

functionName

string

The function name in the function app.

httpTriggerUrl

string

The http trigger url where http request sent to.

name

string

The name of the azure function receiver. Names must be unique across all receivers within an action group.

useCommonAlertSchema

boolean

False

Indicates whether to use common alert schema.

Context

The context info

Name Type Description
contextType

string

The context id type

notificationSource

string

The source of the notification request

EmailReceiver

An email receiver.

Name Type Default Value Description
emailAddress

string

The email address of this receiver.

name

string

The name of the email receiver. Names must be unique across all receivers within an action group.

status

ReceiverStatus

The receiver status of the e-mail.

useCommonAlertSchema

boolean

False

Indicates whether to use common alert schema.

ErrorResponse

Describes the format of Error response.

Name Type Description
code

string

Error code

message

string

Error message indicating why the operation failed.

EventHubReceiver

An Event hub receiver.

Name Type Default Value Description
eventHubName

string

The name of the specific Event Hub queue

eventHubNameSpace

string

The Event Hub namespace

name

string

The name of the Event hub receiver. Names must be unique across all receivers within an action group.

subscriptionId

string

The Id for the subscription containing this event hub

tenantId

string

The tenant Id for the subscription containing this event hub

useCommonAlertSchema

boolean

False

Indicates whether to use common alert schema.

ItsmReceiver

An Itsm receiver.

Name Type Description
connectionId

string

Unique identification of ITSM connection among multiple defined in above workspace.

name

string

The name of the Itsm receiver. Names must be unique across all receivers within an action group.

region

string

Region in which workspace resides. Supported values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope'

ticketConfiguration

string

JSON blob for the configurations of the ITSM action. CreateMultipleWorkItems option will be part of this blob as well.

workspaceId

string

OMS LA instance identifier.

LogicAppReceiver

A logic app receiver.

Name Type Default Value Description
callbackUrl

string

The callback url where http request sent to.

name

string

The name of the logic app receiver. Names must be unique across all receivers within an action group.

resourceId

string

The azure resource id of the logic app receiver.

useCommonAlertSchema

boolean

False

Indicates whether to use common alert schema.

NotificationRequestBody

The request body which contain contact detail metadata

Name Type Description
alertType

string

The value of the supported alert type. Supported alert type values are: servicehealth, metricstaticthreshold, metricsdynamicthreshold, logalertv2, smartalert, webtestalert, logalertv1numresult, logalertv1metricmeasurement, resourcehealth, activitylog, actualcostbudget, forecastedbudget

armRoleReceivers

ArmRoleReceiver[]

The list of ARM role receivers that are part of this action group. Roles are Azure RBAC roles and only built-in roles are supported.

automationRunbookReceivers

AutomationRunbookReceiver[]

The list of AutomationRunbook receivers that are part of this action group.

azureAppPushReceivers

AzureAppPushReceiver[]

The list of AzureAppPush receivers that are part of this action group.

azureFunctionReceivers

AzureFunctionReceiver[]

The list of azure function receivers that are part of this action group.

emailReceivers

EmailReceiver[]

The list of email receivers that are part of this action group.

eventHubReceivers

EventHubReceiver[]

The list of event hub receivers that are part of this action group.

itsmReceivers

ItsmReceiver[]

The list of ITSM receivers that are part of this action group.

logicAppReceivers

LogicAppReceiver[]

The list of logic app receivers that are part of this action group.

smsReceivers

SmsReceiver[]

The list of SMS receivers that are part of this action group.

voiceReceivers

VoiceReceiver[]

The list of voice receivers that are part of this action group.

webhookReceivers

WebhookReceiver[]

The list of webhook receivers that are part of this action group.

ReceiverStatus

Indicates the status of the receiver. Receivers that are not Enabled will not receive any communications.

Name Type Description
Disabled

string

Enabled

string

NotSpecified

string

SmsReceiver

An SMS receiver.

Name Type Description
countryCode

string

The country code of the SMS receiver.

name

string

The name of the SMS receiver. Names must be unique across all receivers within an action group.

phoneNumber

string

The phone number of the SMS receiver.

status

ReceiverStatus

The status of the receiver.

TestNotificationDetailsResponse

The details of the test notification results.

Name Type Description
actionDetails

ActionDetail[]

The list of action detail

completedTime

string

The completed time

context

Context

The context info

createdTime

string

The created time

state

string

The overall state

VoiceReceiver

A voice receiver.

Name Type Description
countryCode

string

The country code of the voice receiver.

name

string

The name of the voice receiver. Names must be unique across all receivers within an action group.

phoneNumber

string

The phone number of the voice receiver.

WebhookReceiver

A webhook receiver.

Name Type Default Value Description
identifierUri

string

Indicates the identifier uri for aad auth.

name

string

The name of the webhook receiver. Names must be unique across all receivers within an action group.

objectId

string

Indicates the webhook app object Id for aad auth.

serviceUri

string

The URI where webhooks should be sent.

tenantId

string

Indicates the tenant id for aad auth.

useAadAuth

boolean

False

Indicates whether or not use AAD authentication.

useCommonAlertSchema

boolean

False

Indicates whether to use common alert schema.