Teilen über


ARM-Vorlagenstichproben für Warnungsregeln für Azure Monitor-Aktivitätsprotokoll (Administrative Kategorie)

Dieser Artikel enthält Beispiele für Azure Resource Manager-Vorlagen zur Erstellung und Konfiguration von Aktivitätsprotokoll-Warnungen für administrative Ereignisse in Azure Monitor.

Hinweis

Eine Liste mit verfügbaren Beispielen und Anleitungen zu deren Bereitstellung in Ihrem Azure-Abonnement finden Sie unter Beispiele für Resource Manager-Vorlagen für Azure Monitor.

Bedingung der Aktivitätsprotokoll-Warnungsregel für die Ereigniskategorie Verwaltung:

In diesem Beispiel wird die Bedingung auf die Kategorie Administrativ festgelegt:

"condition": {
          "allOf": [
            {
              "field": "category",
              "equals": "Administrative"
            },
            {
              "field": "resourceType",
              "equals": "Microsoft.Resources/deployments"
            }
          ]
        }
{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "activityLogAlertName": {
      "type": "string",
      "metadata": {
        "description": "Unique name (within the Resource Group) for the Activity log alert."
      }
    },
    "activityLogAlertEnabled": {
      "type": "bool",
      "defaultValue": true,
      "metadata": {
        "description": "Indicates whether or not the alert is enabled."
      }
    },
    "actionGroupResourceId": {
      "type": "string",
      "metadata": {
        "description": "Resource Id for the Action group."
      }
    }
  },
  "resources": [   
    {
      "type": "Microsoft.Insights/activityLogAlerts",
      "apiVersion": "2017-04-01",
      "name": "[parameters('activityLogAlertName')]",      
      "location": "Global",
      "properties": {
        "enabled": "[parameters('activityLogAlertEnabled')]",
        "scopes": [
            "[subscription().id]"
        ],        
        "condition": {
          "allOf": [
            {
              "field": "category",
              "equals": "Administrative"
            },
            {
              "field": "operationName",
              "equals": "Microsoft.Resources/deployments/write"
            },
            {
              "field": "resourceType",
              "equals": "Microsoft.Resources/deployments"
            }
          ]
        },
        "actions": {
          "actionGroups":
          [
            {
              "actionGroupId": "[parameters('actionGroupResourceId')]"
            }
          ]
        }
      }
    }
  ]
}

Nächste Schritte