Public/Deploy/Monitor/metricAlerts/New-CmAzMonitorMetricAlerts.json

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "Alerts": {
            "type": "array"
        }
    },
    "resources": [
        {
            "type": "Microsoft.Insights/metricAlerts",
            "name": "[parameters('Alerts')[copyIndex('AlertCopy')].name]",
            "apiVersion": "2018-03-01",
            "location": "global",
            "tags": {
                "cm-service": "[parameters('Alerts')[copyIndex('AlertCopy')].service.publish.metricAlert]"
            },
            "copy": {
                "name": "AlertCopy",
                "count": "[length(parameters('Alerts'))]"
            },
            "properties": {
                "description": "[parameters('Alerts')[copyIndex('AlertCopy')].description]",
                "enabled": "[parameters('Alerts')[copyIndex('AlertCopy')].enabled]",
                "severity": "[parameters('Alerts')[copyIndex('AlertCopy')].severity]",
                "scopes": "[parameters('Alerts')[copyIndex('AlertCopy')].scopes]",
                "autoMitigate": true,
                "targetResourceType": "[parameters('Alerts')[copyIndex('AlertCopy')].resourceType]",
                "targetResourceRegion": "[parameters('Alerts')[copyIndex('AlertCopy')].targetResourceLocation]",
                "evaluationFrequency":"[parameters('Alerts')[copyIndex('AlertCopy')].schedule.frequencyInMinutes]",
                "windowSize": "[parameters('Alerts')[copyIndex('AlertCopy')].schedule.timeWindowInMinutes]",
                "criteria": {
                    "odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
                    "allOf": "[parameters('Alerts')[copyIndex('AlertCopy')].criterias]"
                },
                "actions": "[parameters('Alerts')[copyIndex('AlertCopy')].actionGroups]"
            }
        }
    ]
}