Azure服务运行状况|所有类型的健康警报

时间:2020-07-07 15:54:52

标签: azure-resource-manager

我想使用ARM模板部署以下内容-

服务健康|健康警报

这些事件将被涵盖在内- 服务,计划维护,健康咨询和安全咨询

我一直以这个模板为基础- https://docs.microsoft.com/en-us/azure/service-health/resource-health-alert-arm-template-guide

但是,这似乎并没有像我在“监视器-警报”中显示的那样。

这个模板化似乎可以做到一些,但我也需要其他类别,但是运气不佳- https://docs.microsoft.com/en-us/azure/service-health/alerts-activity-log-service-notifications-arm?tabs=CLI

想知道是否有人遇到过这种情况,或者这是仅门户设置的一种类型。

谢谢

1 个答案:

答案 0 :(得分:0)

请尝试以下ARM模板,其中包括所有事件:服务,计划维护,运行状况咨询和安全咨询。

{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
  "actionGroups_name": {
    "defaultValue": "SubHealth",
    "type": "String"
  },
  "activityLogAlerts_name": {
    "defaultValue": "ServiceHealthActivityLogAlert",
    "type": "String"
  },
  "emailAddress":{
    "type":"string"
  }
},
"variables": {
  "alertScope":"[concat('/','subscriptions','/',subscription().subscriptionId)]"
},
"resources": [
  {
    "comments": "Action Group",
    "type": "microsoft.insights/actionGroups",
    "apiVersion": "2019-06-01",
    "name": "[parameters('actionGroups_name')]",
    "location": "Global",
    "tags": {},
    "scale": null,
    "properties": {
      "groupShortName": "[parameters('actionGroups_name')]",
      "enabled": true,
      "emailReceivers": [
        {
          "name": "[parameters('actionGroups_name')]",
          "emailAddress": "[parameters('emailAddress')]"
        }
      ],
      "smsReceivers": [],
      "webhookReceivers": []
    },
    "dependsOn": []
  },
  {
    "comments": "Service Health Activity Log Alert",
    "type": "microsoft.insights/activityLogAlerts",
    "apiVersion": "2017-04-01",
    "name": "[parameters('activityLogAlerts_name')]",
    "location": "Global",
    "tags": {},
    "scale": null,
    "properties": {
      "scopes": [
        "[variables('alertScope')]"
      ],
      "condition": {
        "allOf": [
          {
            "field": "category",
            "equals": "ServiceHealth"
          }
        ]
      },
      "actions": {
        "actionGroups": [
          {
            "actionGroupId": "[resourceId('microsoft.insights/actionGroups', parameters('actionGroups_name'))]",
            "webhookProperties": {}
          }
        ]
      },
      "enabled": true,
      "description": ""
    },
    "dependsOn": [
      "[resourceId('microsoft.insights/actionGroups', parameters('actionGroups_name'))]"
    ]
  }
]  }
相关问题