I am trying to create the default alerts that’s created from an availability webtest. If you create it manually through the portal I can see that the scope is the webtest and the condition is “Whenever the average failed locations is greater than or equal to 1 count" .

I have no idea how to create this using terraform.

I am unsure on the metric namespace, metric name, or whether a dimension is needed. I cannot find any information on this particular alert type.

resource “azurerm_monitor_metric_alert” “auth” {
count = local.environment_name == “Production” ? 1 : 0
name = “UpOrDown-${var.applicationname}-Auth”
resource_group_name = var.appsharedmodule-rg-name
scopes = []
criteria {
metric_namespace = “Microsoft.Insights/Webtests”
metric_name = “failedLocationCount”
aggregation = “Average”
operator = “GreaterThanOrEqual”
threshold = 1
action {
action_group_id = var.appsharedmodule-action-group-id
severity = 0

Does anyone have any ideas?