【问题标题】:Azure Application Insights Alert Rule in ARM TemplateARM 模板中的 Azure Application Insights 警报规则
【发布时间】:2017-10-17 14:31:36
【问题描述】:

我正在尝试将 Application Insights 设置为附加到 Function App 和一些 Web API(Azure 应用服务)。

理想情况下,我们希望整个部署过程从 VSTS 构建和发布完全自动化,因此我们不必从 Azure 门户设置资源。

我为它创建了 ARM 模板并设法让它创建一个新的 Application Insight Azure 资源,但是它没有显示我想要的其他设置(即警报规则、计费类型和每日数据上限) .

目前是否可以通过 ARM 模板设置警报规则?如果是这样,有人可以帮忙验证我是否有 ARM 模板:)?

 {
      "comments": "App Insight Alert Rule",
      "type": "microsoft.insights/alertrules",
      "name": "[parameters('AppInsights.AlertRuleName')]",
      "apiVersion": "2014-04-01",
      "location": "East US",
      "tags": {
        "[concat('hidden-link:/subscriptions/',subscription().subscriptionId,'/resourcegroups/',parameters('ResourceGroupName'),'/providers/microsoft.insights/components/',parameters('AppInsights.Name'))]": "Resource"
      },
      "properties": {
        "name": "[parameters('AppInsights.AlertRuleName')]",
        "description": "",
        "isEnabled": true,
        "condition": {
          "odata.type": "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition",
          "dataSource": {
            "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource",
            "resourceUri": "[resourceId('microsoft.insights/components', parameters('AppInsights.Name'))]",
            "metricName": "requestFailed.count"
          },
          "threshold": 1,
          "windowSize": "PT5M"
        },
        "action": {
          "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleEmailAction",
          "customEmails": "[array(parameters('AppInsights.AlertSubscriber'))]"
        }
      },
      "dependsOn": [
        "[resourceId('microsoft.insights/components', parameters('AppInsights.Name'))]"
      ]
    },
    {

      "type": "microsoft.insights/components",
      "kind": "web",
      "name": "[parameters('AppInsights.Name')]",
      "apiVersion": "2014-04-01",
      "location": "eastus",
      "tags": {},
      "properties": {
        "ApplicationId": "[parameters('AppInsights.Name')]"
      },
      "dependsOn": []
    },
       {
        "name": "[variables('billingplan')]",
        "type": "microsoft.insights/components/CurrentBillingFeatures",
        "location": "East US",
        "apiVersion": "2015-05-01",
        "dependsOn": [
          "[resourceId('microsoft.insights/components', parameters('AppInsights.Name'))]"
        ],
        "properties": {
          "CurrentBillingFeatures": "[variables('pricePlan')]",
          "DataVolumeCap": {
            "Cap": "[parameters('AppInsights.DailyQuota')]"
          }
        }
      }
  ]
  }

谢谢

哈里斯

【问题讨论】:

标签: azure azure-web-app-service azure-functions azure-application-insights


【解决方案1】:

我终于发现问题是由于我具有相同的警报规则名称(不知道警报规则被视为资源并且需要具有唯一名称..)。

所以我最终将警报重命名为不同的名称,重新部署了解决方案并最终创建了警报规则:)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-12-09
    • 1970-01-01
    • 1970-01-01
    • 2020-04-16
    • 2018-12-13
    • 2021-10-08
    • 1970-01-01
    相关资源
    最近更新 更多