Can I customize the email template I receive when an Azure Alert Rule is triggered?

Mislav Jurić 0 Reputation points
2024-09-05T14:52:55.7066667+00:00

Dear Microsoft Developer Community,

I have multiple Azure Container Apps in the same resource group. In that resource group, I also have a Log Analytics workspace. I was able to set up an Alert rule which is triggered by a query I wrote for that Log Analytics workspace.

What I want to know now is whether I can customize the email I get when the alert gets triggered. Currently it looks like this (the standard template):

Unedited

I know I can see the query results if I scroll a bit down in the email and click on "View query results", but what I want is to include the information I capture in the query for the alert. Is it possible to do that? In other words, can I customize the email template?

Thank you in advance!

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
3,196 questions
Azure Container Apps
Azure Container Apps
An Azure service that provides a general-purpose, serverless container platform.
399 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Dan Rios 1,980 Reputation points MVP
    2024-09-06T09:27:23.12+00:00

    To the best of my knowledge, no you cannot amend that template. However, what you could do is look to do is amend the action group associated to the alert, to trigger a logic app instead. This way you can parse the alert details through various connections such as the SMTP connector, see more here: https://learn.microsoft.com/en-us/azure/logic-apps/connectors/built-in/reference/smtp/

    This way you can not only parse the alert information to the body, but you will then be able to edit the body to your desire, including a HTML body if you wish. Essentially, allowing you to fully customise the email template to your choosing.

    As for your question around the query results itself, this should also be possible by playing with parsing the data into the logic app, see here for a guide: https://learn.microsoft.com/en-us/azure/azure-monitor/alerts/alerts-logic-apps?tabs=send-email

    Alert schema for Azure Monitor: https://learn.microsoft.com/en-us/azure/azure-monitor/alerts/alerts-common-schema#sample-alert-payload

    I hope this helps you, if so, please feel free to mark as the accepted answer so others can benefit from the answer. Thanks

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.