首页 文章

ARM模板中的Azure应用程序洞察警报规则

提问于
浏览
2

我正在尝试设置Application Insights以附加功能应用程序和几个Web API(Azure应用程序服务) .

理想情况下,我们希望整个部署过程从VSTS Build and Release完全自动化,因此我们不必从Azure Portal设置资源 .

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

Is setting up Alert Rules currently available via ARM template? if so can someone please help and verify if the ARM template I've got :)?

{
      "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')]"
          }
        }
      }
  ]
  }

谢谢

哈里斯

1 回答

  • 0

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

    所以我最终将警报重命名为不同的东西,重新部署解决方案,最后创建警报规则:) .

相关问题