Using Power Automate for telemetry alerts

by Nov 10, 2023Telemetry

Home 9 User Experience 9 Telemetry 9 Using Power Automate for telemetry alerts

Using Power Automate for telemetry alerts

Note: This flow is created from this template: App Insights Monitoring Alert Email | Microsoft Power Automate; however, I made a few changes to the structure/flow to support our requirements better.

Telemetry (Application Insights) is a great tool to see what is happening. However, both KQL queries and Telemetry PowerBI apps require users to go to the app and check if something has happened. This may be great for some unexpected things, but if you want to really proactive, the best way is to be notified whenever something happens.

You can use different options for notifying – Insights Alerts, PowerBI Alerts or Power Automate. In this article, I will describe the last option – Power Automate.

Power Automate for telemetry

The Power Automate is really simple – we just need to run the KQL script, transform and process the response and send the results to other applications (Teams, Email etc…).

The first three steps are simple

  • Use the recurrence as a trigger. For these notifications, I run the power automate every hour.
  • The second step specifies the recipient emails. You can specify the email directly in the emailing step, but I always prefer to have the configuration option before everything else.
  • The third step is the most important – it’s the connector for Application Insights that will query our telemetry and return the results. In my example, I’m looking for signals with the EventId AL0000JRG (failed and stopped job queues), except objects 260, 1441 and 1509 (failed emails and notifications).
    • DO NOT FORGET to set the same period as you have for the trigger!

The next step is a condition that checks whether the previous query returned any content. I use the returned dataset (together with the length() expression) and verify that the length of the returned dataset is greater than 0.

And finally, the last two steps

  • If the previous condition is false (length(returnedResults) is equal to 0) the flow ends.
  • If it’s non-empty, it creates a CSV table from the returned resultsset and attaches it as an email attachment to the email sent to my address.

It’s simple, isn’t it?

Recent Articles from the category

Setting up telemetry for BC environments (VAR)

Setting up telemetry for BC environments (VAR)

Setting up telemetry for BC environments (VAR) A few weeks back, I published a blog post about controlling the cost of telemetry using the transformation rules. However, I found (thanks to my colleagues from Fusion5) that I don't have any blog posts about setting up...

read more

Sign Up for News


Highest certification
Microsoft Data Management and
also in D365 Business Central

Microsoft Certified: Dynamics 365 Business Central Functional Consultant Associate

See other certifications here