将Arm模板部署到Azure时发生内部服务器错误

时间:2018-12-27 14:25:32

标签: azure automation metrics arm-template

我正在使用ARM模板向Azure部署新的指标警报。 我正在遵循Microsoft doc的完全相同的方式。 唯一的变化是,我仅将一个指标部署到一个自动化帐户而不是一个存储帐户

模板文件

  "variables": {
    "criterion1": "[array(parameters('criterion1'))]",
    "criteria": "[concat(variables('criterion1'))]"


},
"resources": [
    {
        "name": "[parameters('alertName')]",
        "type": "Microsoft.Insights/metricAlerts",
        "location": "global",
        "apiVersion": "2018-03-01",
        "tags": {},
        "properties": {
            "description": "[parameters('alertDescription')]",
            "severity": "[parameters('alertSeverity')]",
            "enabled": "[parameters('isEnabled')]",
            "scopes": [
                "[parameters('resourceId')]"
            ],
            "evaluationFrequency": "[parameters('evaluationFrequency')]",
            "windowSize": "[parameters('windowSize')]",
            "criteria": {
                "odata.type": "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria",
                "allOf": "[variables('criteria')]"
            },
            "actions": [
                {}
            ]
        }
    }
]

参数文件

  "criterion1": {
            "value": {
                "name": "1st criterion",
                "metricName": "TotalJob",
                "dimensions": [
                    {
                        "name": "Status",
                        "operator": "Include",
                        "values": [
                            "Failed"
                        ]
                    },
                    {
                        "name": "Status",
                        "operator": "Include",
                        "values": [
                            "Completed"
                        ]
                    }
                ],
                "operator": "GreaterThan",
                "threshold": "5",
                "timeAggregation": "Total"
            }
        }

但是当我将其部署到Azure时,即使使用-DeploymentDebugLogLevel All参数,我的Powershell命令也会卡住而不会给出任何错误。在Azure门户中,我收到没有任何上下文的错误“内部服务器错误”。 json日志为我提供了以下日志:

{
"authorization": {
    "action": "Microsoft.Insights/metricAlerts/write",
    "scope": "/subscriptions/xxxxxx/resourcegroups/bilalachahbar/providers/Microsoft.Insights/metricAlerts/New Metric Alert"
},
"caller": "xxxx",
"channels": "Operation",
"claims": {
    "aud": "https://management.azure.com/",
    "iss": "https://sts.windows.net/17b5a1d-057c-4ac-a15a-08758f7a7064/",
    "iat": "15596014",
    "nbf": "15596014",
    "exp": "15599914",
    "aio": "42RgYDgypS7rfe/Of0l1R+q3TbCgA=",
    "appid": "0e4a093a-c6fd-4fba-b4e5-f07ba479f203",
    "appidacr": "1",
    "http://schemas.microsoft.com/identity/claims/identityprovider": "https://sts.windows.net/17b35a1d-057c-4ac5-a15a-08758f7a7064/",
    "http://schemas.microsoft.com/identity/claims/objectidentifier": "a3db39bf-8c65-4b84-b049-d7af99bfb3e",
    "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier": "a3db39bf-8c65-4b84-b049-d7af99bfb3e",
    "http://schemas.microsoft.com/identity/claims/tenantid": "17b35a1d-057c-4ac5-a15a-087f7a7064",
    "uti": "SCkIk235EScz0Hst20AA",
    "ver": "1.0"
},
"correlationId": "8013b5-9788-41ed-afcf-0dbd8276349c",
"description": "",
"eventDataId": "e39509-0837-4435-af7a-02ba1462055f",
"eventName": {
    "value": "EndRequest",
    "localizedValue": "End request"
},
"category": {
    "value": "Administrative",
    "localizedValue": "Administrative"
},
"eventTimestamp": "2018-12-27T14:11:48.1462445Z",
"id": "/subscriptions/xxxxx/resourcegroups/xxxxxx/providers/Microsoft.Insights/metricAlerts/New+Metric+Alert/events/e39509-0837-4435-af7a-02ba1462055f/ticks/815167081462445",
"level": "Error",
"operationId": "e390389-ecc1-4a2-8c2-d94ea635cb",
"operationName": {
    "value": "Microsoft.Insights/metricAlerts/write",
    "localizedValue": "Create or update metric alert"
},
"resourceGroupName": "xxxxx",
"resourceProviderName": {
    "value": "Microsoft.Insights",
    "localizedValue": "Microsoft Insights"
},
"resourceType": {
    "value": "Microsoft.Insights/metricAlerts",
    "localizedValue": "Microsoft.Insights/metricAlerts"
},
"resourceId": "/subscriptions/xxxxxx/resourcegroups/bilalachahbar/providers/Microsoft.Insights/metricAlerts/New Metric Alert",
"status": {
    "value": "Failed",
    "localizedValue": "Failed"
},
"subStatus": {
    "value": "InternalServerError",
    "localizedValue": "Internal Server Error (HTTP Status Code: 500)"
},
"submissionTimestamp": "2018-12-27T14:12:05.0719055Z",
"subscriptionId": "xxxxxx",
"properties": {
    "statusCode": "InternalServerError",
    "serviceRequestId": "8613b5-9788-41d-afcf-0dbd27639c",
    "statusMessage": "{\"error\":{\"code\":\"InternalServerError\",\"message\":\"The server encountered an internal error, please retry. If the problem persists, contact support.\"}}"
},
"relatedEvents": []

}

另一个stack overflow问题也有同样的问题。 当使用不再受支持的资源时,他遇到了问题,但我想事实并非如此,因为官方的MS文档来自今年9月。使用文档中提供的完全相同的手臂模板时,我遇到了相同的问题

1 个答案:

答案 0 :(得分:1)

我发现了自己的错误 要部署度量标准警报时,需要有操作组。 如您在文档中所见,它们提供了一个动作ID,而我没有。正如我认为的那样,实际上没有必要。 我知道这很明显,但是不幸的是我没有在文档或错误中看到它。经过一些调试并在Resource Explorer中查看后,我注意到了这一点。 希望以后的读者能解决您的问题

一点反馈是,没有依赖于ATM的值,所以我不能先在同一手臂模板中创建动作组资源