다음을 통해 공유


Azure Monitor 서비스 상태 경고 규칙에 대한 Resource Manager 템플릿 샘플

이 문서에는 Azure Monitor에서 서비스 상태 경고를 만들고 구성하기 위한 Azure Resource Manager 템플릿 샘플이 포함되어 있습니다.

참고 항목

사용 가능한 샘플 목록과 Azure 구독에 배포하는 방법에 대한 지침은 Azure Monitor에 대한 Azure Resource Manager 샘플을 참조하세요.

서비스 상태 경고 규칙을 만들기 위한 템플릿

다음 템플릿은 대상 구독에 대한 서비스 상태 이벤트의 알림을 보내는 서비스 상태 경고 규칙을 만듭니다. 이 템플릿을 CreateServiceHealthAlert.json으로 저장하고 필요에 따라 수정합니다.

주의할 사항:

  1. 서비스 상태 경고 규칙의 '범위'는 단일 구독만 포함할 수 있으며, 이 구독은 규칙이 만들어진 구독과 동일해야 합니다. 여러 구독, 리소스 그룹 또는 다른 유형의 범위는 지원되지 않습니다.
  2. "전역" 위치에만 서비스 상태 경고 규칙을 만들 수 있습니다.
  3. 규칙 조건 내의 "properties.incidentType", "properties.impactedServices[].ServiceName" 및 "properties.impactedServices[].ImpactedRegions[*].RegionName" 절은 선택 사항입니다. 이러한 절을 제거하여 모든 인시던트 유형, 모든 서비스 및/또는 모든 지역에 대해 전송된 각각의 이벤트에 대해 알림을 받을 수 있습니다.
  4. "properties.impactedServices[*].ServiceName" 에 사용되는 서비스 이름은 유효한 Azure 서비스 이름이어야 합니다. Resource Health 메타데이터 목록 API에서 유효한 이름 목록을 검색할 수 있습니다.
{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "actionGroups_name": {
      "type": "string",
      "defaultValue": "SubHealth"
    },
    "activityLogAlerts_name": {
      "type": "string",
      "defaultValue": "ServiceHealthActivityLogAlert"
    },
    "emailAddress": {
      "type": "string"
    }
  },
  "variables": {
    "alertScope": "[format('/subscriptions/{0}', subscription().subscriptionId)]"
  },
  "resources": [
    {
      "type": "microsoft.insights/actionGroups",
      "apiVersion": "2020-10-01",
      "name": "[parameters('actionGroups_name')]",
      "location": "Global",
      "properties": {
        "groupShortName": "[parameters('actionGroups_name')]",
        "enabled": true,
        "emailReceivers": [
          {
            "name": "[parameters('actionGroups_name')]",
            "emailAddress": "[parameters('emailAddress')]"
          }
        ],
        "smsReceivers": [],
        "webhookReceivers": []
      }
    },
    {
      "type": "microsoft.insights/activityLogAlerts",
      "apiVersion": "2017-04-01",
      "name": "[parameters('activityLogAlerts_name')]",
      "location": "Global",
      "properties": {
        "scopes": [
          "[variables('alertScope')]"
        ],
        "condition": {
          "allOf": [
            {
              "field": "category",
              "equals": "ServiceHealth"
            },
            {
              "field": "properties.incidentType",
              "equals": "Incident"
            },
			{                     
			   "field": "properties.impactedServices[*].ServiceName",                     
			   "containsAny": [
                  "SQL Database",
                  "SQL Managed Instance"    
               ]                 
			},
            {                     
				"field": "properties.impactedServices[*].ImpactedRegions[*].RegionName",
                "containsAny": [
                   "Australia Central"
                ]
            }
          ]
        },
        "actions": {
          "actionGroups": [
            {
              "actionGroupId": "[resourceId('microsoft.insights/actionGroups', parameters('actionGroups_name'))]",
              "webhookProperties": {}
            }
         ]
        },
        "enabled": true
      },
      "dependsOn": [
        "[resourceId('microsoft.insights/actionGroups', parameters('actionGroups_name'))]"
      ]
    }
  ]
}

다음 단계