[英]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.