【问题标题】:Internal server error while deploying an arm template to azure将 arm 模板部署到 azure 时出现内部服务器错误
【发布时间】:2018-12-27 14:25:31
【问题描述】:

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

模板文件

  "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 时,我的 Powershell 命令卡住了,即使带有 -DeploymentDebugLogLevel All 参数也没有给出任何错误。在 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/17xxxxxc5-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": "1xxxxxx057c-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 月开始的。当我使用文档中提供的完全相同的手臂模板时,我遇到了同样的问题

【问题讨论】:

    标签: azure automation metrics arm-template


    【解决方案1】:

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

    一个小反馈是没有依赖值 ATM,所以我不能先在同一个 arm 模板中创建操作组资源

    【讨论】:

      猜你喜欢
      • 2022-08-20
      • 2021-04-10
      • 1970-01-01
      • 2023-03-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-09
      • 1970-01-01
      相关资源
      最近更新 更多