Logic App Consumption
  • 05 Jan 2025
  • 2 Minutes to read
  • Dark
    Light
  • PDF

Logic App Consumption

  • Dark
    Light
  • PDF

Article summary

In this sample we will look at the scenario for the employee benefits process in Logic App Consumption where we read data from a data source and push it to partners.

image.png

When you open a transaction you can see the detail of the steps we have processed.

image.png

Video Walk Thru

The below video gives a detailed walk through of this sample.

Parent Query

let runStartedEvent = AzureDiagnostics 
| where OperationName == "Microsoft.Logic/workflows/workflowActionCompleted"
| where ResourceGroup == "EAI_APP_EMPLOYEEBENEFITSFILES"
| where resource_workflowName_s == "EmployeeBenefits-To-BenefitsManagement-Partner"
| where resource_actionName_s == "Parse_JSON_-_Tracking_Args"
| extend FileName = trackedProperties_fileName_s
| extend WorkFlowName = resource_workflowName_s
| extend WorkFlowRunID = resource_runId_s
| order by TimeGenerated desc 
| project TimeGenerated, FileName, WorkFlowName, WorkFlowRunID;
let workflowCompetedEvents = AzureDiagnostics 
| where ResourceGroup == "EAI_APP_EMPLOYEEBENEFITSFILES"
| where resource_workflowName_s == "EmployeeBenefits-To-BenefitsManagement-Partner"
| where OperationName == "Microsoft.Logic/workflows/workflowRunCompleted"
| extend Result = status_s
| extend Start = startTime_t
| extend End = endTime_t
| extend WorkFlowName = resource_workflowName_s
| extend WorkFlowRunID = resource_runId_s
| order by TimeGenerated desc
| project WorkFlowRunID, Result, Start, End;
runStartedEvent | join kind=inner workflowCompetedEvents on WorkFlowRunID
| project TimeGenerated, FileName, WorkFlowName, WorkFlowRunID,Result, Start, End
| order by TimeGenerated desc

Child Queries

Get Employee Data

This is the first stage and shows how to append the url so you can go to the Azure portal.  In the below query there are a couple of things to note, the main one being that I an dynamically creating a url which I can project into the BAM portal which I can click to open the run history in the logic app.

The other point to note is that with the project statement I am limiting the list of columns I will return if I only want to show the user certain columns.

let input_RunId = {WorkFlowRunID};
let subscriptionId = "08a281b8-3b07-4219-a517-b11230e9b34";
let resourceGroup = "EAI_APP_EMPLOYEEBENEFITSFILES";
let logicAppName = "EmployeeBenefits-To-BenefitsManagement-Partner";
let actionName = "HTTP_-_GET_EMPLOYEE_BENEFITS_DATASET";
let azurePortalUrlTemplate = "https://portal.azure.com/#view/Microsoft_Azure_EMA/DesignerEditorConsumption.ReactView/id/%2Fsubscriptions%2F[subscriptionId]f%2FresourceGroups%2F[resourceGroup]%2Fproviders%2FMicrosoft.Logic%2Fworkflows%2F[logicAppName]/location/northeurope/showGoBackButton~/true/isReadOnly~/true/isMonitoringView~/true/runId/%2Fsubscriptions%2F[subscriptionId]f%2FresourceGroups%2F[resourceGroup]%2Fproviders%2FMicrosoft.Logic%2Fworkflows%2F[logicAppName]%2Fruns%2F[RunId]";   
let lookups = dynamic([ '[subscriptionId]', '[resourceGroup]', '[logicAppName]', '[RunId]' ]);
AzureDiagnostics 
| where ResourceGroup == resourceGroup
| where resource_workflowName_s == logicAppName
| where Resource == actionName
| where ResourceProvider == "MICROSOFT.LOGIC"
| where ResourceType == "WORKFLOWS/RUNS/ACTIONS"
| where OperationName == "Microsoft.Logic/workflows/workflowActionCompleted"
//This field uses the property shared from the parent
| where resource_runId_s  == input_RunId
//Here we will extend the tracked property from the logic app
| extend FileName = trackedProperties_fileName_s
| extend WorkFlowName = resource_workflowName_s
| extend WorkFlowRunID = resource_runId_s
| extend duration = endTime_t - startTime_t
| extend PortalUrl = replace_strings(azurePortalUrlTemplate, lookups, pack_array(subscriptionId, resourceGroup, logicAppName, resource_runId_s))
| project TimeGenerated, ResourceId, ResourceGroup, SubscriptionId, Resource, ResourceType, OperationName, status_s, startTime_t, endTime_t, resource_runId_s, resource_workflowName_s, correlation_actionTrackingId_g, correlation_clientTrackingId_s, correlation_parentRunId_s, CorrelationId, WorkFlowName, WorkFlowRunID, duration, PortalUrl

Transform Data

This looks up the transform data action from the Logic App

AzureDiagnostics 
| where ResourceProvider == "MICROSOFT.LOGIC"
| where ResourceGroup == "EAI_APP_EMPLOYEEBENEFITSFILES"
| where resource_workflowName_s == "EmployeeBenefits-To-BenefitsManagement-Partner"
| where ResourceType == "WORKFLOWS/RUNS/ACTIONS"
| where OperationName == "Microsoft.Logic/workflows/workflowActionCompleted"
| where Resource == "COMPOSE_-_PARTNER_MESSAGE"
| where resource_runId_s  == {WorkFlowRunID}
| extend FileName = trackedProperties_fileName_s
| extend WorkFlowName = resource_workflowName_s
| extend WorkFlowRunID = resource_runId_s

Deliver File to Partner

This looks up the deliver file to partner action.

AzureDiagnostics 
| where ResourceProvider == "MICROSOFT.LOGIC"
| where ResourceGroup == "EAI_APP_EMPLOYEEBENEFITSFILES"
| where resource_workflowName_s == "EmployeeBenefits-To-BenefitsManagement-Partner"
| where ResourceType == "WORKFLOWS/RUNS/ACTIONS"
| where OperationName == "Microsoft.Logic/workflows/workflowActionCompleted"
| where Resource == "CREATE_BLOB_(V2)"
| where resource_runId_s  == {WorkFlowRunID}
| extend FileName = trackedProperties_fileName_s
| extend WorkFlowName = resource_workflowName_s
| extend WorkFlowRunID = resource_runId_s


Was this article helpful?

What's Next
ESC

Eddy AI, facilitating knowledge discovery through conversational intelligence