
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.
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
- Showing Trends
- Grouping by subscription/group/workflow/SKU etc.
- Preparing links to go into specific failed workflows
- Do analytical deep-dives to find more
- 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
- Go to Azure App Insights, paste the KQL query, and select export as Power Query (M langauge)
- 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!