Azure Functions and Logic Apps are both serverless offerings from Azure, but they solve different problems and excel in different scenarios.

Let’s see Logic Apps in action. Imagine you need to automatically process incoming emails. You can set up a Logic App with a trigger for "When a new email arrives (V3)" in Outlook. Then, for each email, you can add an action to "Create item" in a SharePoint list. This entire workflow, from trigger to action, is configured visually with no code. You can easily add more steps, like sending a notification via Teams or saving an attachment to OneDrive, all through drag-and-drop connectors.

{
    "definition": {
        "contentVersion": "1.0.0.0",
        "parameters": {},
        "triggers": {
            "When_a_new_email_arrives": {
                "type": "ApiConnection",
                "displayName": "When a new email arrives",
                "description": "Checks for new emails in your Outlook.com account.",
                "runtimeUrl": "https://logic-apis.azure.com/v2/connections/outlook/triggers/When_a_new_email_arrives/runs",
                "connection": {
                    "name": "@parameters('$connections')['outlook']['connectionId']"
                },
                "inputs": {
                    "host": {
                        "connection": {
                            "name": "@parameters('$connections')['outlook']['connectionId']"
                        }
                    },
                    "method": "get",
                    "path": "/v2/Mail/GetMessages",
                    "queries": {
                        "folder": "Inbox",
                        "top": 1
                    }
                }
            }
        },
        "actions": {
            "Create_item": {
                "type": "ApiConnection",
                "displayName": "Create item",
                "description": "Creates a new item in a SharePoint list.",
                "runtimeUrl": "https://logic-apis.azure.com/v2/connections/sharepoint/actions/CreateItem/runs",
                "connection": {
                    "name": "@parameters('$connections')['sharepoint']['connectionId']"
                },
                "inputs": {
                    "host": {
                        "connection": {
                            "name": "@parameters('sharepoint')?['connectionId']"
                        }
                    },
                    "method": "post",
                    "body": "@body('When_a_new_email_arrives')",
                    "path": "/v2/sites/@{encodeURIComponent('your_sharepoint_site')}/lists/@{encodeURIComponent('your_sharepoint_list')}/items"
                }
            }
        },
        "outputs": {}
    },
    "schemaVersion": "1.0.0.0"
}

Logic Apps are designed for orchestrating complex business processes and integrating disparate systems. They excel at handling workflows that involve multiple steps, conditional logic, loops, and human interaction. The core problem they solve is making it easy to connect different services and automate business processes without writing significant amounts of code. Internally, Logic Apps use a state machine model. Each step is an action or trigger, and the workflow engine manages the state transitions between them, handling retries, error handling, and logging automatically. The levers you control are the connectors, the workflow logic (sequential, parallel, conditional), and the data transformations between steps.

Azure Functions, on the other hand, are ideal for event-driven, single-purpose compute. They are essentially small pieces of code that run in response to an event. Think of them as microscopic, highly scalable microservices. Where Logic Apps orchestrate, Functions execute.

Let’s look at a Function. Suppose you want to process an image uploaded to Azure Blob Storage. You can write a Function (e.g., in C#) that triggers when a new blob is created. This Function might then resize the image, extract metadata, or apply a filter. The code itself handles the specific logic.

using System;
using System.IO;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.Extensions.Logging;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Processing;

public static class ResizeImage
{
    [FunctionName("ResizeImage")]
    public static void Run([BlobTrigger("images/{name}", Connection = "AzureWebJobsStorage")] Stream myBlob, string name, ILogger log)
    {
        log.LogInformation($"C# Blob trigger function Processed blob\n Name:{name} \n Size: {myBlob.Length} Bytes");

        using (var image = Image.Load(myBlob))
        {
            image.Mutate(x => x.Resize(image.Width / 2, image.Height / 2));
            // Save the resized image back to blob storage, perhaps to a different container/path
            // This requires setting up an output binding for blob storage in function.json
            // Example: using (var outputStream = File.OpenWrite($"path/to/resized/{name}")) { image.Save(outputStream, new PngEncoder()); }
            log.LogInformation($"Image {name} resized successfully.");
        }
    }
}

The key difference lies in their purpose: Logic Apps are for orchestration and integration with a visual, low-code approach. Functions are for computation and event-driven execution with a code-first approach. You use Logic Apps when you need to string together multiple services and manage complex business workflows. You use Functions when you need to write custom code to perform specific tasks triggered by events, or when you need fine-grained control over execution and performance.

The one thing that often trips people up is the perceived overlap. Both can be triggered by events, and both can call other services. However, the depth of integration and the complexity of the logic are where they diverge. Logic Apps have built-in connectors for hundreds of services, making it trivial to interact with them. For custom integrations or complex business logic within a step, Functions are more powerful and flexible. A common pattern is to use Logic Apps for the overall workflow and call Azure Functions for specific, complex processing steps within that workflow.

If you find yourself writing a lot of "glue code" in Azure Functions to call different APIs and handle their responses, you might be better off using Logic Apps for that orchestration.

Want structured learning?

Take the full Azure-functions course →