🎉 75% of content is free forever — Unlock Premium from $10/mo →
CW
NEWSLIVESearch All Content
đŸ’ŧ Servicesâ„šī¸ Aboutâœ‰ī¸ ContactView Pricing Plansfrom $10

Azure Logic Apps for Data Workflows and Event Automation

Azure Data EngineeringLogic Apps⭐ Premium
Azure Data Engineering

The glue between systems that were never designed to meet

12 min read📘Intermediate

Prerequisites

  • !Azure Data Factory trigger and pipeline concepts
  • !Managed identities and API connections
  • !Basic understanding of integration runtimes

What You'll Learn

  • 1Decide between Consumption and Standard Logic Apps for a workload
  • 2Design file-arrival and event-driven triggers that start ETL reliably
  • 3Build error handling with scopes, retries, and compensation
  • 4Model costs accurately before choosing a plan

What Logic Apps are actually for

Logic Apps are a managed, visual workflow engine: a trigger starts a run, actions execute in sequence or in parallel branches, and each action is a connector call to some system. The engine handles retries, state, and durable execution, so a workflow that waits three days for a partner response costs nothing while it waits and resumes exactly where it left off. That durable wait is the single feature that separates Logic Apps from a cron job with a script, and it is the reason integration teams reach for them.

In a data engineering context, Logic Apps sit in the seams between systems that Data Factory does not model natively. They react to a blob landing in a raw container and kick off an ADF pipeline with the file name as a parameter. They poll a SaaS API for new records on a schedule. They mediate between an on-premises SQL Server and a cloud data lake through the On-Premises Data Gateway. They send the Teams notification when a nightly load finishes, and the Teams escalation when it fails twice. None of these are hard to write as code; all of them are tedious to make durable, observable, and retry-safe by hand.

ScenarioBest toolWhy
Complex multi-step ETL with dependenciesData FactoryPipeline orchestration, data flows, integration runtime
Blob arrival triggers a single pipelineLogic Apps or ADF blob triggerEither works; Logic Apps if more connectors are needed
Poll a SaaS API on a scheduleLogic AppsHundreds of managed connectors, no code
On-premises system integrationLogic Apps with gatewayGateway handles secure hybrid connectivity
Long-running partner wait statesLogic AppsDurable waits cost nothing while idle
Heavy custom computationAzure FunctionsLogic Apps charge per action; code is cheaper for compute

Consumption versus Standard: the plan decision

Consumption Logic Apps run on a serverless multi-tenant host and bill per action execution, roughly a fraction of a cent per action, with no idle cost. That makes them ideal for sporadic workloads: a file arrives twice a day, a partner sends a nightly batch, an alert needs a notification. The trade-offs are per-run action limits, single-region execution per logic app, and less control over networking.

Standard Logic Apps run on a dedicated App Service plan inside an integration service environment or a standard logic app resource. They bill for the plan, not per action, so at high volume the per-action cost drops dramatically. They also support virtual network integration, higher throughput, and multiple stateful workflows per resource. The decision heuristic is simple: model both for your expected action volume, and if the Consumption projection exceeds the Standard plan cost by more than a modest margin, move to Standard.

# Create a Consumption logic app with the CLI
az logicapp create \
  --name la-de-file-arrival-dev \
  --resource-group rg-de-dev \
  --location eastus \
  --consumption-plan-location eastus \
  --storage-account stlogicdev001 \
  --functions-version 4

# Create a Standard logic app on a dedicated plan for high-volume workloads
az logicapp create \
  --name la-de-partner-sync-prod \
  --resource-group rg-de-prod \
  --location eastus \
  --plan la-plan-prod \
  --storage-account stlogicprod001 \
  --functions-version 4

The file-arrival pattern that starts ETL reliably

The most common data engineering Logic App watches a storage container for new files and triggers an ADF pipeline per file. The design details that separate a toy from a production workflow are the deduplication strategy and the failure path. Without deduplication, a file that is still being written when the trigger fires can be processed twice or processed as truncated. The robust pattern is to move the file to a processing subfolder as the first action, which both claims it and gives the ADF pipeline a stable path to read.

{
  "definition": {
    "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
    "actions": {
      "Get_New_Files": {
        "type": "ApiConnection",
        "inputs": {
          "host": { "connection": { "name": "@parameters('$connections')['azureblob']['connectionId']" } },
          "method": "get",
          "path": "/v2/datasets/@{encodeURIComponent('raw')}/foldersV2/@{encodeURIComponent('incoming')}"
        },
        "runAfter": {}
      },
      "For_Each_File": {
        "type": "Foreach",
        "foreach": "@body('Get_New_Files')?['value']",
        "actions": {
          "Trigger_ADF_Pipeline": {
            "type": "ApiConnection",
            "inputs": {
              "host": { "connection": { "name": "@parameters('$connections')['azuredatafactory']['connectionId']" } },
              "method": "post",
              "path": "/v1/subscriptions/@{encodeURIComponent(variables('subscriptionId'))}/resourceGroups/@{encodeURIComponent(variables('resourceGroup'))}/providers/Microsoft.DataFactory/factories/@{encodeURIComponent(variables('factoryName'))}/createRun",
              "body": {
                "referenceName": "pl_process_landing_file",
                "parameters": {
                  "fileName": "@items('For_Each_File')?['name']",
                  "fileSize": "@items('For_Each_File')?['size']"
                }
              }
            },
            "retryPolicy": {
              "type": "exponential",
              "count": 4,
              "interval": "PT2M"
            }
          }
        },
        "runAfter": {},
        "runtimeConfiguration": { "concurrency": { "repetitions": 5 } }
      },
      "Send_Summary": {
        "type": "ApiConnection",
        "inputs": {
          "host": { "connection": { "name": "@parameters('$connections')['office365']['connectionId']" } },
          "method": "post",
          "body": {
            "To": "[email protected]",
            "Subject": "Landing files processed",
            "Body": "@{length(body('Get_New_Files')?['value'])} files dispatched to ADF"
          }
        },
        "runAfter": { "For_Each_File": [ "Succeeded" ] }
      }
    },
    "triggers": {
      "Recurrence": {
        "type": "Recurrence",
        "recurrence": { "frequency": "Minute", "interval": 5 },
        "runAfter": {}
      }
    }
  }
}

Error handling: scopes, retries, and compensation

Every action in a Logic App has a retry policy, and the default exponential policy is usually sensible. What is not automatic is containment. The scope action wraps a group of steps and lets you declare which completion states should be handled, so a failure inside the scope routes to a catch branch instead of failing the whole run. This is the Try, Catch, Finally pattern applied to integration, and it is the difference between a workflow that pages someone at 3 a.m. and one that retries, notifies, and moves on.

Compensation is the subtler sibling. If an action has already written to a downstream system and a later action fails, the correct response is often to undo the write, not just to retry the failure. Logic Apps support compensation through explicit undo actions you define after the original action, and while that adds visual complexity, it prevents the half-applied states that make integration bugs so hard to debug.

{
  "actions": {
    "Try_Process": {
      "type": "Scope",
      "actions": {
        "Call_Vendor_API": {
          "type": "Http",
          "inputs": {
            "method": "POST",
            "uri": "https://vendor.example.com/api/orders",
            "body": "@{triggerBody()?['orderPayload']}"
          },
          "retryPolicy": { "type": "exponential", "count": 3, "interval": "PT1M" }
        },
        "Write_Confirmation": {
          "type": "ApiConnection",
          "inputs": {
            "host": { "connection": { "name": "@parameters('$connections')['azuredatafactory']['connectionId']" } },
            "method": "post",
            "path": "/v1/confirmations"
          },
          "runAfter": { "Call_Vendor_API": [ "Succeeded" ] }
        }
      },
      "runAfter": {},
      "runtimeConfiguration": { "consecutiveRetryCount": 1 }
    },
    "Catch_Process": {
      "type": "If",
      "expression": "@not(equals(actions('Try_Process')?['status'], 'Succeeded'))",
      "actions": {
        "Compensate_Write": {
          "type": "Http",
          "inputs": {
            "method": "DELETE",
            "uri": "https://vendor.example.com/api/orders/@{triggerBody()?['orderId']}"
          }
        },
        "Alert_OnCall": {
          "type": "Email",
          "inputs": {
            "body": "Order @{triggerBody()?['orderId']} failed and was compensated",
            "subject": "Integration failure"
          },
          "runAfter": { "Compensate_Write": [ "Succeeded", "Failed", "Skipped" ] }
        }
      },
      "runAfter": { "Try_Process": [ "Failed", "TimedOut" ] }
    }
  }
}

Hybrid connectivity with the On-Premises Data Gateway

Many data estates still include an on-premises SQL Server or a file share that must participate in cloud workflows. The On-Premises Data Gateway is the standard bridge: it runs inside your network, initiates outbound connections to Azure, and lets Logic Apps reach internal systems without opening inbound firewall holes. One gateway can serve multiple services, including Logic Apps, Power Automate, and Power BI, so installing it once simplifies the whole hybrid estate.

Operational notes that save future pain: install the gateway on a machine that is not a developer laptop, register it with a service principal rather than a personal account, and monitor its health through the gateway metrics in Azure Monitor. A gateway that silently goes offline stops workflows with an error that looks like a connector failure, which sends the on-call engineer in the wrong direction.

Cost modeling before you build

Consumption pricing is roughly a fraction of a cent per action plus connector throughput charges. A workflow that runs every five minutes, iterates twenty files, and calls three actions per file is about 17,000 actions a day, or over half a million a month. At that volume the Consumption bill can exceed a Standard plan, and the crossover point is easy to calculate before deployment. The modeling habit worth building is to estimate actions per run times runs per month for each candidate workflow, price both plans, and pick with numbers instead of defaults.

The second cost lever is action efficiency. Replacing a chain of five HTTP actions that could be a single built-in transformation with one action cuts both cost and latency. Filtering the trigger's file list to relevant extensions before entering the foreach avoids iterating over files the pipeline would only ignore. Neither optimization is glamorous; both compound across hundreds of workflows in a busy integration estate.

Common Mistakes

Processing a blob the moment it lands, before the writer has closed the file

Fix: Use a short recurrence poll and move the file to a processing folder as the claiming step before invoking ADF

Letting a failure inside a foreach stop the whole run with no catch branch

Fix: Wrap risky actions in a scope with a catch branch that notifies and, where needed, compensates downstream writes

Leaving every workflow on Consumption because it is simplest to start

Fix: Model actions per month and compare with Standard plan cost; move high-volume workflows to Standard before the bill surprises you

Running the gateway on a personal workstation

Fix: Install the gateway on a managed, always-on machine under a service principal and monitor its health like any other production dependency

Best Practices

  • Claim files by moving them before processing so retries cannot double-process
  • Set explicit exponential retry policies on external connector calls and bound concurrency on foreach loops
  • Use scopes with catch branches so failures notify instead of silently failing runs
  • Tag logic apps with environment and cost-center and review action volume monthly
  • Separate B2B partner workflows onto their own logic apps so revoking a partner is a disable, not a redesign

Interview Questions

Q1: When would you use Logic Apps instead of Azure Functions for data engineering?

Logic Apps when the work is workflow orchestration across many connectors, especially with durable waits and visual approval steps. Azure Functions when the work is custom code or heavy computation, because charging per action becomes expensive for compute-heavy steps. Many estates use both: Logic Apps to orchestrate, Functions for the custom logic steps.

Q2: How do Logic Apps integrate with on-premises systems?

Through the On-Premises Data Gateway, which runs inside your network and initiates outbound connections to Azure. Connectors that support the gateway can reach internal SQL Servers and file shares without inbound firewall openings, and one gateway serves Logic Apps, Power Automate, and Power BI.

Q3: Explain the cost difference between Consumption and Standard plans.

Consumption bills per action execution with no idle cost, which suits sporadic workloads. Standard bills for a dedicated App Service plan, so cost is fixed and per-action cost drops at high volume. Model both against expected monthly action counts before choosing; the crossover is often lower than teams assume.

Q4: How do you handle errors in a Logic App?

Use the built-in exponential retry policies for transient failures, wrap risky sequences in a scope action with a catch branch for containment, and add explicit compensation actions to undo downstream writes when a later step fails. Notify through an action group or email so failures never disappear silently.

Key Takeaways

  • Logic Apps excel at durable, connector-heavy orchestration where waiting costs nothing and retries must be reliable
  • Claim incoming files by moving them before processing so triggers cannot double-fire on a half-written blob
  • Scopes with catch branches and explicit compensation turn failures into contained, recoverable events
  • Model actions per month against both plans; high-volume workflows usually justify Standard
  • The On-Premises Data Gateway is the standard hybrid bridge; run it on managed infrastructure and monitor it
🔒

Premium Content

Azure Logic Apps for Data Workflows and Event Automation

You've previewed the first section. Unlock this full lesson and 900+ advanced tutorials with a Premium plan.

đŸŽ¯End-to-end Projects
đŸ’ŧInterview Prep
📜Certificates
🤝Community Access

Already a member? Log in

CW

ChatWhole Learn Editorial Team

Written by experienced data scientists, software engineers, and educators. All content is reviewed by industry professionals to ensure accuracy and relevance.

Last reviewed: 2026-10-13

—
☆☆☆☆☆
0 ratings

Rate & Feedback

Advertisement