none
Smart Detection - Failure Anomalies - Alert create manually using ARM templates for existing App Insights RRS feed

  • Question

  • Hi,

    I have few app insight and Alerts (Smart Detection - Failure Anomalies) which already created in past. As you all know "Classic Alert" will be retired on 31st March 2019.

    In my scenario, I want to Create New alert manually by ARM templates. Previously it was  "Failure Anomalies - appinsightname01" of "type": "Microsoft.Insights/alertRules". Here, appinsightname01 is an application insight name and this alert created automatically on app insight.

    Now, after 31st August this will no longer support so I want to create new using ARM templates Manually.

    It's supported using code as we create "MetricAlert, AuditLogs, LogSearch" ?

    Please give me your views.
    Thanks 
    Monday, July 8, 2019 5:01 PM

Answers

  • Hi JigsVala,

    Thank you for reaching out!

    You may use the below ARM template for Failure Anomalies v2 (non-classic) alert rule:

    {
        "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
        "contentVersion": "1.0.0.0",
        "resources": [
            {
                "type": "microsoft.alertsmanagement/smartdetectoralertrules",
                "apiVersion": "2019-03-01",
                "name": "Failure Anomalies - my-app",
                "properties": {
                      "description": "Detects a spike in the failure rate of requests or dependencies",
                      "state": "Enabled",
                      "severity": "2",
                      "frequency": "PT1M",
                      "detector": {
                      "id": "FailureAnomaliesDetector"
                      },
                      "scope": ["/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/microsoft.insights/components/my-app"],
                      "actionGroups": {
                            "groupIds": ["/subscriptions/00000000-1111-2222-3333-444444444444/resourcegroups/MyResourceGroup/providers/microsoft.insights/actiongroups/MyActionGroup"]
                      }
                }
            }
        ]
    }

    https://docs.microsoft.com/en-us/azure/azure-monitor/app/proactive-arm-config#failure-anomalies-v2-non-classic-alert-rule

    Hope this helps!

    Tuesday, July 9, 2019 9:41 AM
    Moderator

All replies

  • Hi JigsVala,

    Thank you for reaching out!

    You may use the below ARM template for Failure Anomalies v2 (non-classic) alert rule:

    {
        "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
        "contentVersion": "1.0.0.0",
        "resources": [
            {
                "type": "microsoft.alertsmanagement/smartdetectoralertrules",
                "apiVersion": "2019-03-01",
                "name": "Failure Anomalies - my-app",
                "properties": {
                      "description": "Detects a spike in the failure rate of requests or dependencies",
                      "state": "Enabled",
                      "severity": "2",
                      "frequency": "PT1M",
                      "detector": {
                      "id": "FailureAnomaliesDetector"
                      },
                      "scope": ["/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/microsoft.insights/components/my-app"],
                      "actionGroups": {
                            "groupIds": ["/subscriptions/00000000-1111-2222-3333-444444444444/resourcegroups/MyResourceGroup/providers/microsoft.insights/actiongroups/MyActionGroup"]
                      }
                }
            }
        ]
    }

    https://docs.microsoft.com/en-us/azure/azure-monitor/app/proactive-arm-config#failure-anomalies-v2-non-classic-alert-rule

    Hope this helps!

    Tuesday, July 9, 2019 9:41 AM
    Moderator
  • Thank you It's working fine :)
    Tuesday, July 9, 2019 11:49 AM
  • I get the following error: Failure Anomalies - myapp' failed with message '{
      "error": {
        "code": "ScopeInUse",
        "message": "A FailureAnomaliesDetector alert rule with id 'XXXXX' is already defined on the resource
    '/subscriptions/YYYYY/resourcegroups/mother-staging/providers/microsoft.insights/components/ZZZZ'. Only a single FailureAnomaliesDetector alert rule can be define for the same resource."

    as the azure portal does not allow the deletion of this rule through the UI I can't test the deployment of this rule without this error

    Friday, August 23, 2019 10:20 AM