Action Groups - Create Notifications At Resource Group Level
将测试通知发送到一组提供的接收方
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/createNotifications?api-version=2021-09-01
URI 参数
| 名称 | 在 | 必需 | 类型 | 说明 |
|---|---|---|---|---|
|
resource
|
path | True |
string minLength: 1maxLength: 90 |
资源组的名称。 名称不区分大小写。 |
|
subscription
|
path | True |
string minLength: 1 |
目标订阅的 ID。 |
|
api-version
|
query | True |
string minLength: 1 |
用于此作的 API 版本。 |
请求正文
| 名称 | 必需 | 类型 | 说明 |
|---|---|---|---|
| alertType | True |
string maxLength: 30 |
支持的警报类型的值。 支持的警报类型值为:servicehealth、metricstaticthreshold、metricsdynamicthreshold、logalertv2、smartalert、webtestalert、logalertv1numresult、logalertv1metricmeasurement、resourcehealth、activitylog、actualcostbudget、forecastedbudget |
| armRoleReceivers |
属于此操作组的 ARM 角色接收器列表。 角色是 Azure RBAC 角色,仅支持内置角色。 |
||
| automationRunbookReceivers |
属于此操作组的 AutomationRunbook 接收器的列表。 |
||
| azureAppPushReceivers |
属于此操作组的 AzureAppPush 接收器列表。 |
||
| azureFunctionReceivers |
属于此操作组的 Azure 函数接收器的列表。 |
||
| emailReceivers |
属于此操作组的电子邮件接收方列表。 |
||
| eventHubReceivers |
属于此操作组的事件中心接收器的列表。 |
||
| itsmReceivers |
属于此操作组的 ITSM 接收器的列表。 |
||
| logicAppReceivers |
属于此操作组的逻辑应用接收器列表。 |
||
| smsReceivers |
属于此操作组的 SMS 接收器列表。 |
||
| voiceReceivers |
属于此操作组的语音接收器列表。 |
||
| webhookReceivers |
属于此操作组的 Webhook 接收器列表。 |
响应
| 名称 | 类型 | 说明 |
|---|---|---|
| 200 OK |
通知成功 |
|
| 202 Accepted |
已接受通知请求 标头 location: string |
|
| Other Status Codes |
发送测试通知时出错 |
安全性
azure_auth
Azure Active Directory OAuth2 流
类型:
oauth2
流向:
implicit
授权 URL:
https://login.microsoftonline.com/common/oauth2/authorize
作用域
| 名称 | 说明 |
|---|---|
| user_impersonation | 模拟用户帐户 |
示例
Create notifications at resource group level
示例请求
POST https://management.azure.com/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-TestNotifications/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
}
]
}
示例响应
location: https://management.azure.com/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/Test-Rg/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
}
]
}
定义
| 名称 | 说明 |
|---|---|
|
Action |
作详细信息 |
|
Arm |
arm 角色接收器。 |
|
Automation |
Azure 自动化 Runbook 通知接收器。 |
|
Azure |
Azure 移动应用推送通知接收器。 |
|
Azure |
Azure 函数接收器。 |
| Context |
上下文信息 |
|
Email |
电子邮件接收方。 |
|
Error |
描述错误响应的格式。 |
|
Event |
事件中心接收器。 |
|
Itsm |
Itsm 接收器。 |
|
Logic |
逻辑应用接收器。 |
|
Notification |
包含联系人详细信息元数据的请求正文 |
|
Receiver |
指示接收方的状态。 未启用的接收方不会接收任何通信。 |
|
Sms |
短信接收器。 |
|
Test |
测试通知结果的详细信息。 |
|
Voice |
语音接收器。 |
|
Webhook |
Webhook 接收器。 |
ActionDetail
作详细信息
| 名称 | 类型 | 说明 |
|---|---|---|
| Detail |
string |
友好错误消息的详细信息 |
| MechanismType |
string |
机制类型 |
| Name |
string |
作的名称 |
| SendTime |
string |
发送时间 |
| Status |
string |
作的状态 |
| SubState |
string |
作的子状态 |
ArmRoleReceiver
arm 角色接收器。
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| name |
string |
arm 角色接收器的名称。 名称在操作组内的所有接收方中必须是唯一的。 |
|
| roleId |
string |
arm 角色 ID。 |
|
| useCommonAlertSchema |
boolean |
False |
指示是否使用常见警报架构。 |
AutomationRunbookReceiver
Azure 自动化 Runbook 通知接收器。
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| automationAccountId |
string |
保存此 Runbook 并向 Azure 资源进行身份验证的 Azure 自动化帐户 ID。 |
|
| isGlobalRunbook |
boolean |
指示此实例是否为全局 Runbook。 |
|
| name |
string |
指示 Webhook 的名称。 |
|
| runbookName |
string |
此 Runbook 的名称。 |
|
| serviceUri |
string |
应在其中发送 Webhook 的 URI。 |
|
| useCommonAlertSchema |
boolean |
False |
指示是否使用常见警报架构。 |
| webhookResourceId |
string |
链接到此 Runbook 的 Webhook 的资源 ID。 |
AzureAppPushReceiver
Azure 移动应用推送通知接收器。
| 名称 | 类型 | 说明 |
|---|---|---|
| emailAddress |
string |
为 Azure 移动应用注册的电子邮件地址。 |
| name |
string |
Azure 移动应用推送接收器的名称。 名称在操作组内的所有接收方中必须是唯一的。 |
AzureFunctionReceiver
Azure 函数接收器。
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| functionAppResourceId |
string |
函数应用的 Azure 资源 ID。 |
|
| functionName |
string |
函数应用中的函数名称。 |
|
| httpTriggerUrl |
string |
HTTP 请求发送到的 http 触发器 URL。 |
|
| name |
string |
Azure 函数接收器的名称。 名称在操作组内的所有接收方中必须是唯一的。 |
|
| useCommonAlertSchema |
boolean |
False |
指示是否使用常见警报架构。 |
Context
上下文信息
| 名称 | 类型 | 说明 |
|---|---|---|
| contextType |
string |
上下文 ID 类型 |
| notificationSource |
string |
通知请求的源 |
EmailReceiver
电子邮件接收方。
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| emailAddress |
string |
此接收方的电子邮件地址。 |
|
| name |
string |
电子邮件接收方的名称。 名称在操作组内的所有接收方中必须是唯一的。 |
|
| status |
电子邮件的接收方状态。 |
||
| useCommonAlertSchema |
boolean |
False |
指示是否使用常见警报架构。 |
ErrorResponse
描述错误响应的格式。
| 名称 | 类型 | 说明 |
|---|---|---|
| code |
string |
错误代码 |
| message |
string |
指示操作失败的原因的错误消息。 |
EventHubReceiver
事件中心接收器。
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| eventHubName |
string |
特定事件中心队列的名称 |
|
| eventHubNameSpace |
string |
事件中心命名空间 |
|
| name |
string |
事件中心接收器的名称。 名称在操作组内的所有接收方中必须是唯一的。 |
|
| subscriptionId |
string |
包含此事件中心的订阅的 ID |
|
| tenantId |
string |
包含此事件中心的订阅的租户 ID |
|
| useCommonAlertSchema |
boolean |
False |
指示是否使用常见警报架构。 |
ItsmReceiver
Itsm 接收器。
| 名称 | 类型 | 说明 |
|---|---|---|
| connectionId |
string |
在上述工作区中定义的多个项中唯一标识 ITSM 连接。 |
| name |
string |
Itsm 接收器的名称。 名称在操作组内的所有接收方中必须是唯一的。 |
| region |
string |
工作区所在的区域。 支持的值:'centralindia'、'japaneast'、'southeastasia'、'australiasoutheast'、'uksouth'、'westcentralus'、'canadacentral'、'eastus'、'westeurope' |
| ticketConfiguration |
string |
ITSM 操作配置的 JSON Blob。 CreateMultipleWorkItems 选项也将是此 Blob 的一部分。 |
| workspaceId |
string |
OMS LA 实例标识符。 |
LogicAppReceiver
逻辑应用接收器。
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| callbackUrl |
string |
http 请求发送到的回调 URL。 |
|
| name |
string |
逻辑应用接收器的名称。 名称在操作组内的所有接收方中必须是唯一的。 |
|
| resourceId |
string |
逻辑应用接收器的 Azure 资源 ID。 |
|
| useCommonAlertSchema |
boolean |
False |
指示是否使用常见警报架构。 |
NotificationRequestBody
包含联系人详细信息元数据的请求正文
| 名称 | 类型 | 说明 |
|---|---|---|
| alertType |
string maxLength: 30 |
支持的警报类型的值。 支持的警报类型值为:servicehealth、metricstaticthreshold、metricsdynamicthreshold、logalertv2、smartalert、webtestalert、logalertv1numresult、logalertv1metricmeasurement、resourcehealth、activitylog、actualcostbudget、forecastedbudget |
| armRoleReceivers |
属于此操作组的 ARM 角色接收器列表。 角色是 Azure RBAC 角色,仅支持内置角色。 |
|
| automationRunbookReceivers |
属于此操作组的 AutomationRunbook 接收器的列表。 |
|
| azureAppPushReceivers |
属于此操作组的 AzureAppPush 接收器列表。 |
|
| azureFunctionReceivers |
属于此操作组的 Azure 函数接收器的列表。 |
|
| emailReceivers |
属于此操作组的电子邮件接收方列表。 |
|
| eventHubReceivers |
属于此操作组的事件中心接收器的列表。 |
|
| itsmReceivers |
属于此操作组的 ITSM 接收器的列表。 |
|
| logicAppReceivers |
属于此操作组的逻辑应用接收器列表。 |
|
| smsReceivers |
属于此操作组的 SMS 接收器列表。 |
|
| voiceReceivers |
属于此操作组的语音接收器列表。 |
|
| webhookReceivers |
属于此操作组的 Webhook 接收器列表。 |
ReceiverStatus
指示接收方的状态。 未启用的接收方不会接收任何通信。
| 值 | 说明 |
|---|---|
| NotSpecified | |
| Enabled | |
| Disabled |
SmsReceiver
短信接收器。
| 名称 | 类型 | 说明 |
|---|---|---|
| countryCode |
string |
短信接收方的国家/地区代码。 |
| name |
string |
短信接收方的名称。 名称在操作组内的所有接收方中必须是唯一的。 |
| phoneNumber |
string |
SMS 接收器的电话号码。 |
| status |
接收方的状态。 |
TestNotificationDetailsResponse
测试通知结果的详细信息。
| 名称 | 类型 | 说明 |
|---|---|---|
| actionDetails |
作详细信息列表 |
|
| completedTime |
string |
已完成的时间 |
| context |
上下文信息 |
|
| createdTime |
string |
创建时间 |
| state |
string |
总体状态 |
VoiceReceiver
语音接收器。
| 名称 | 类型 | 说明 |
|---|---|---|
| countryCode |
string |
语音接收器的国家/地区代码。 |
| name |
string |
语音接收器的名称。 名称在操作组内的所有接收方中必须是唯一的。 |
| phoneNumber |
string |
语音接收器的电话号码。 |
WebhookReceiver
Webhook 接收器。
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| identifierUri |
string |
指示 aad 身份验证的标识符 URI。 |
|
| name |
string |
Webhook 接收器的名称。 名称在操作组内的所有接收方中必须是唯一的。 |
|
| objectId |
string |
指示 aad 身份验证的 Webhook 应用对象 ID。 |
|
| serviceUri |
string |
应在其中发送 Webhook 的 URI。 |
|
| tenantId |
string |
指示 aad 身份验证的租户 ID。 |
|
| useAadAuth |
boolean |
False |
指示是否使用 AAD 身份验证。 |
| useCommonAlertSchema |
boolean |
False |
指示是否使用常见警报架构。 |