0

我使用下面的 JSON 来创建 AI 警报,效果很好。但是,当我尝试在此 JSON 文件中添加多个警报时,它会创建几个警报,有时是一个,有时是两个或三个,最后返回配置状态为Failed。它永远不会在 JSON 中创建所有警报(六)。

{
        "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#",
        "contentVersion": "1.0.0.0",
        "parameters": {
            "AlertName": {
                    "type": "string"
            },
        "Location": {
                    "type": "string",
             "defaultValue": "East US"
            },
        "ResourceGroup": {
                    "type": "string"
            },
        "ResourceName": {
                    "type": "string"
            }
        },
    "resources": [{
                "apiVersion": "2014-04-01",
                "name": "[parameters('AlertName')]",
                "type": "microsoft.insights/alertrules",
        "location": "[parameters('Location')]",
                "tags": {
                    "displayName": "AppInsightsAlert"
                },
                "properties": {
                    "name": "[concat('AppInsightsAlert ', parameters('AlertName'))]",
                    "description": "[concat('App Insights Alert ', parameters('AlertName'))]",
                    "isEnabled": true,
                    "condition": {
                            "odata.type": "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition",
                            "dataSource": {
                                "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource",
                                "resourceUri": "[concat('/subscriptions/<subscription id>/resourcegroups/',  parameters('ResourceGroup'), '/providers/microsoft.insights/components/',  parameters('ResourceName'))]",
                                "metricName": "view.count"
                            },
                            "threshold": 1,
                    "windowSize": "PT5M"
                    },
                    "action": {
                            "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleEmailAction",
                            "sendToServiceOwners": true,
                        "customEmails": []
                    }
                }
        }]
}
4

1 回答 1

0

您是否使用 PowerShell 进行部署 - 如果是,请将 -debug 开关添加到 New-AzureResourceGroup* 命令并筛选输出。来自平台的原始错误就在那里,而且通常非常好。如果这没有帮助,您可以为失败的部署发布整个 json 模板吗?

于 2015-08-20T20:03:18.800 回答