Highlight

If you need to report status of your logic apps, you can, and it’s easy with app insights. Let me show you how.

So reporting logic app status is easy, you can do it natively in Azure with monitor or notebooks, but if you want you can also export it's data into Power BI, where your possibilities explode.

Why Power BI?

I’m not here to sell you on Power BI. But honestly, when it works, it works. The amount of things you can do in Power BI compared to what Azure natively provides is so much better.

For example

  1. Showing Trends
  2. Grouping by subscription/group/workflow/SKU etc.
  3. Preparing links to go into specific failed workflows
  4. Do analytical deep-dives to find more
  5. And more…

App Insights KQL

If you navigate to application insights, you can use below KQL to find all finished workflows. Whether they are failed or succeeded. If you want you can remove WorkflowEnd condition to show queued or running workflows.

Here is the KQL that I use

traces
| where severityLevel == '1'
and operation_Id <> ''
and (customDimensions.EventName == ""WorkflowRunEnd"

Power BI

If you want you can then use that KQL to export data into Power BI.

For that you have two options

  1. Go to Azure App Insights, paste the KQL query, and select export as Power Query (M langauge)
  2. Open Power BI, load data as blank query, and paste below into advanced editor

Logic Apps Data - Power Query

= let Source = Json.Document(Web.Contents("https://api.applicationinsights.io/v1/apps/<your_id>/query", 
[Query=[#"query"="traces
| where severityLevel == '1'
and operation_Id <> ''
and (customDimensions.EventName == ""WorkflowRunEnd"")
",#"x-ms-app"="AAPBI",#"timespan"="P7D",#"prefer"="ai.response-thinning=true"],Timeout=#duration(0,0,4,0)])),
TypeMap = #table(
{ "AnalyticsTypes", "Type" }, 
{ 
{ "string",   Text.Type },
{ "int",      Int32.Type },
{ "long",     Int64.Type },
{ "real",     Double.Type },
{ "timespan", Duration.Type },
{ "datetime", DateTimeZone.Type },
{ "bool",     Logical.Type },
{ "guid",     Text.Type },
{ "dynamic",  Text.Type }
}),
DataTable = Source[tables]{0},
Columns = Table.FromRecords(DataTable[columns]),
ColumnsWithType = Table.Join(Columns, {"type"}, TypeMap , {"AnalyticsTypes"}),
Rows = Table.FromRows(DataTable[rows], Columns[name]), 
Table = Table.TransformColumnTypes(Rows, Table.ToList(ColumnsWithType, (c) => { c{0}, c{3}}))
in
Table

In case you want you can also build a logic app URL into a specific workflow that you show. This is very useful to find logic app workflows that failed.

Logic Apps Transform URL

"https://portal.azure.com/#view/Microsoft_Azure_EMA/DesignerEditor.ReactView/id/" & 
   Text.Replace([LogicAppsResources.id], "/", "%2F") & 
   "%2Fworkflows%2F" & [workflowName] & 
   "/location/" & 
   [LogicAppsResources.location] & 
   "/isReadOnly~/true/isMonitoringView~/true/runId/" & 
   [runId]

Where

  • LogicAppsResources.id - you need to get logic app resource ID of logic app you are reporting on
  • LogicAppsResources.location - a location (azure region) of your logic app, ex. westeurope

Thoughts? Lemme know!

Adam Marczak

Programmer, architect, trainer, blogger, evangelist are just a few of my titles. What I really am, is a passionate technology enthusiast. I take great pleasure in learning new technologies and finding ways in which this can aid people every day. My latest passion is running an Azure 4 Everyone YouTube channel, where I show that Azure really is for everyone!

Did you enjoy the article?

Share it!

More tagged posts