简体   繁体   English

ARM模板中的Azure Application Insights警报规则

[英]Azure Application Insights Alert Rule in ARM Template

I'm trying to setup Application Insights to be attached against Function App, and few Web API's (Azure App Service). 我正在尝试将Application Insights设置为针对Function App附加,并且很少使用Web API(Azure App Service)。

Ideally we want the whole deployment process to be fully automated from VSTS Build and Release so we don't have to setup the resource from Azure Portal. 理想情况下,我们希望整个部署过程从VSTS Build and Release实现完全自动化,因此我们不必从Azure Portal设置资源。

I've created the ARM template for it and managed to get it to create a new Azure resource of Application Insight, however it's not showing the other settings that I want (ie Alert Rules, Billing Type, and Daily Data Cap). 我已经为其创建了ARM模板,并设法使其创建了Application Insight的新Azure资源,但是它没有显示我想要的其他设置(即警报规则,计费类型和每日数据上限)。

Is setting up Alert Rules currently available via ARM template? 当前是否可以通过ARM模板设置警报规则? if so can someone please help and verify if the ARM template I've got :)? 如果可以的话,有人可以帮助并验证我是否拥有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')]"
          }
        }
      }
  ]
  }

Thanks 谢谢

Harris 哈里斯

I've finally found out that the issue was due to me having same Alert Rule names (wasn't aware that alert rules are treated as resource and need to have unique names..). 我终于发现问题是由于我使用了相同的警报规则名称(不知道警报规则被视为资源并且需要具有唯一的名称。)。

So I ended up renaming the alert to something different, redeployed the solution and it finally creates the alert rules :). 因此,我最终将警报重命名为其他内容,重新部署了解决方案,最终创建了警报规则:)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Web测试中未启用Azure ARM模板中的警报规则 - Alert rule in Azure ARM template not enabled in web test 使用ARM模板成功创建了Azure日志警报规则,但未出现在门户中 - Azure log alert rule created successfully with ARM template but not appearing in portal 使用 Terraform(或 ARM 模板)为 Web 测试创建 Azure 警报规则? - Creating an Azure Alert Rule for a Webtest with Terraform (or ARM template)? Azure Application Insights警报电子邮件 - Azure Application Insights Alert Emails 将 Url 规则从不同的 ARM 模板添加到 Azure 应用程序网关 - Add Url Rule to Azure Application Gateway from a different ARM template 通过ARM模板的Web App和应用程序见解 - Web App and Application Insights via ARM template Microsoft 的用于 Application Insights 的 Azure ARM 模板中的“Flow_type”属性是什么? - What is the "Flow_type" attribute in Microsoft's Azure ARM Template for Application Insights? 如何使用ARM模板通过应用程序洞察为实时azure Web应用程序启用性能分析 - How to enable profiling for live azure web apps with application insights using an ARM template 创建 Azure Application Insights 警报时出错 - Error while creating an Azure Application Insights alert Azure:使用 ARM 模板部署日志警报失败 - Azure: Failed log alert deployment with ARM template
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM