none
Metric Alert ARM Template deployment — InternalServerError

    Question

  • I've tried to create Metric Alert under Web Test, using next template:

    {
      "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
      "contentVersion": "1.0.0.0",
      "parameters": { "appName": {
            "type": "string",
            "metadata": {
              "description": "The name of the app insights instance."
            }
          },
          "WebTestName":
          {
            "type": "string",
            "defaultValue": "MyWebTest",
            "metadata": {
                "description": "The name of the Web Test instance"
            }
          },"rulesCount":
          {
              "type": "int",
              "defaultValue": 2,
              "minValue": 1,
              "maxValue": 99,
              "metadata": {
                  "description": "Number of metric alerts to be created under webtest. Metric alerts are created under single webtest to simplify management"
              }
    
          }},
      "resources": [{
                "name": "[concat(parameters('appName'), '-', parameters('WebTestName'),'-WebTest', copyIndex() )]",
                "type": "Microsoft.Insights/metricAlerts",
                "apiVersion": "2018-03-01",
                "location": "global",
                "tags": {
    				"[concat('hidden-link:', resourceId('microsoft.insights/components', parameters('appName') ) )]": "Resource",
    				"[concat('hidden-link:', resourceId('microsoft.insights/webtests', concat(toLower(parameters('WebTestName')), '-', toLower(parameters('appName')) )))]": "Resource"
                },
                "properties": {
                    "description": "",
                    "enabled":true,
                    "evaluationFrequency": "PT1M",
                    "severity": 3,
                    "windowSize": "PT5M",
                    "actions":[
                    ],
                    "criteria":{
                        "odata.type": "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria",
                        "webTestId": "[concat(toLower(parameters('WebTestName')), '-', toLower(parameters('appName')))]",
                        "componentId": "[resourceId('microsoft.insights/components', parameters('appName'))]",
                        "failedLocationCount": 1
                    }
                },
                "copy": {
                    "name": "createAlerts",
                    "count": "[parameters('rulesCount')]"
                  }
            }
            ]
    }

    And got InternalServerError with message "

    The server encountered an internal error, please retry. If the problem persists, contact support".

    I've tried deployment twice, both with same result.

    Questions:
    1) I am able to create multiple Metric Alerts or Classic Alert Rules all with different conditions under a single Web Test, am I not?

    2) Is something wrong with the template? Do I have to specify something more? 


    • Edited by GimGu Thursday, November 22, 2018 5:04 PM
    Wednesday, November 21, 2018 11:16 AM

All replies