2

We are creating azure monitor alerts through terraform using below code. There is a field azurerm provides to customize email subject. But it never seems to work. The email subject always has something like

"Fired: Sev4 Azure Monitor Alert [alert-name] at [time]"

How to customize the email subject for Azure Monitor Alerts through terraform?

resource "azurerm_monitor_scheduled_query_rules_alert" "example" {
  name                = format("%s-queryrule", var.prefix)
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name

  action {
    action_group           = []
    email_subject          = "Email Header" // This never works !!!
  }

  data_source_id = azurerm_application_insights.example.id
  description    = "Alert when total results cross threshold"
  enabled        = true
  query       = <<-QUERY
  requests
    | where tolong(resultCode) >= 500
    | summarize count() by bin(timestamp, 5m)
  QUERY
}
danielorn
  • 5,254
  • 1
  • 18
  • 31
Jawahar
  • 4,775
  • 1
  • 24
  • 47

1 Answers1

0

Alerts v2 have removed ability to customize subject line.

I believe the expected use is to now send to Logic App and build a custom email there.

C. Parcell
  • 313
  • 1
  • 5