In the era of automation and artificial intelligence, it is important that workflows and processes work seamlessly. If the workflow stops working or stops with an error, the situation must be caught as soon as possible and not wait for a situation where users start to wonder why the system is malfunctioning. A prerequisite for critical applications is to turn on monitoring, so that the system notifies you when something is wrong.

Microsoft’s Power Automate is a powerful tool that helps automate repetitive tasks and workflows. Power Automate does not show several weeks of execution history and it is not quick to search for an incorrect execution. The more workflows there are, the bigger the haystack the bug hunt grows. This is where Application Insights comes into play, providing visibility and monitoring for automations.

Integration with Application Insights

Power Automate has become a natural way to transfer performance logs directly to Azure’s Application Insights. The feature is still in Preview mode. This feature allows administrators to connect their Microsoft Power Platform environment to an Application Insights instance to more advanced diagnose and monitor their automations.

However, the feature requires that the Power Platform environments are Managed environments. It is essential to understand that turning on the managed environment requires all users to have a Power Platform Premium license. If, for example, SharePoint and Power Apps applications that do not require a Premium license have been used in the environments before, by turning on the managed environment, a higher license will be required from the user.

How does it work?

Data Exporting creation causes the logs to flow into Application Insights In. Create a Data Export Power Platfrom the Admin Center under the Analytics heading.
Data Exporting creation causes the logs to flow into Application Insights In. Create a Data Export Power Platform the Admin Center under the Analytics heading.

First, the environment must be made a managed environment, then a Data Export is created, which defines to which Azure Application Insights instance the Power Automate logs of the environment are sent. After a day, Application Insights starts to find executions and error situations of workflows.

So in practice, if an error occurs, you will receive a notification, you can locate the error quickly and watch the workflow straightening, without having to search for it. You can mark the data with the identifier you want, which makes it easier to see the path of one thing in the middle of a wider application. For example, if the Power Platform functionality consists of several Power Apps and Power Automate workflows, you can see the progress of a user or issue from Application Insights without having to separately examine the log of each element in Power Platform.

In order to get a reasonable idea of the progress of the information, you need to add scope elements to the workflows, which can be used to package functionalities and give context to error messages. Instead of the workflow crashing with error 123, you can get a message that data A could not be written to location B because error 123 occurred. For this, Power Automate workflows need error handling, as shown in the image below.

Power Automate's error handling using Scope elements helps structure the workflow and functionality where the error occurs.
Power Automate’s error handling using Scope elements helps structure the workflow and functionality where the error occurs.

The last task is to retrieve data from Application Insights. You can track errors or search the logs for the executions of all Power Automata or just errors. You can monitor just one workflow or all at once. Once you find the way you want to track error situations, it’s time to create the alerts.

Build the alarms to suit your desired maintenance and project. Alarms can be directed directly to the desired channels. It is recommended to refer to the maintenance service and possibly to other channels in addition to that. Ticket-based maintenance services work in the background, which provides instructions for dealing with problems more efficiently.

An example of how to retrieve from Application Insights logs all Power Automate workflow startup and error lines from the last week.
An example of how to retrieve from Application Insights logs all Power Automate workflow startup and error lines from the last week.

Power Platform consulting and project deliveries are key elements in the digital transformation of companies. The continuity of the life cycle ensures that the solutions remain up-to-date and respond to the changing needs of the business. The consulting process starts with the mapping of needs, from which we move on to planning and implementation. After the end of the project, maintenance and continuous development guarantee operational reliability and enable continuous improvement. This cycle creates a foundation upon which sustainable growth and innovation can be built.