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
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"]
}
}
}
]
}
Hope this helps!