Lesson 5 of 6 Compute Solutions

Choosing Serverless Hosting and Workflows

This lesson explains Azure Functions hosting plans, Durable Functions and Azure Logic Apps.

Learning outcomes

After completing this lesson, you will be able to:

  • Compare the Functions hosting plans.
  • Describe Durable Functions patterns.
  • Choose between Functions and Logic Apps.

Azure Functions

Azure Functions runs small pieces of code in response to triggers, such as an HTTP request, a queue message, a timer or a blob event. Bindings connect a function to other services declaratively, reducing integration code. The platform scales out according to demand. Functions suit short, stateless tasks: processing messages, responding to webhooks and running scheduled clean-up.

Hosting plans

The hosting plan determines scaling, duration, networking and cost, and it is the main design decision for Functions.

Flex Consumption

Flex Consumption is the recommended serverless plan. It charges for execution, scales fast to as many as 1,000 instances per function group, supports virtual network integration, and allows always ready instances to reduce cold starts. Memory sizes of 512 MB, 2 GB and 4 GB are available.

Premium

The Premium plan keeps instances warm, avoiding cold starts, with a charge for allocated instances. It supports virtual network connectivity, and it suits steady, latency-sensitive use, or requirements for custom Linux containers.

Dedicated

A Dedicated plan runs functions on an App Service plan. It suits existing plans with spare capacity, and it provides predictable cost, but it does not scale to zero.

Container Apps

Functions can be hosted on Azure Container Apps as Linux containers. This suits an organization that runs its other services on Container Apps, and wants one environment.

Consumption

The original Consumption plan is now a legacy option, with a default timeout of 5 minutes and a maximum of 10. It has no virtual network integration. Hosting on Linux in this plan retires on 30 September 2028, so new designs should use Flex Consumption.

The following comparison recaps the plans. In all plans, HTTP-triggered functions must respond within 230 seconds, because of the load balancer's idle timeout, so longer work should be handed to a queue or a durable orchestration.

Flex Consumption
Scale to zeroYes
Maximum durationUnbounded
Virtual network integrationYes
StatusRecommended
Choose when Most new serverless work
Premium
Scale to zeroNo
Maximum durationUnbounded
Virtual network integrationYes
StatusCurrent
Choose when Warm instances and steady load
Dedicated
Scale to zeroNo
Maximum durationUnbounded
Virtual network integrationYes
StatusCurrent
Choose when Existing plans with spare capacity
Consumption
Scale to zeroYes
Maximum duration10 minutes
Virtual network integrationNo
StatusLegacy
Choose when Existing apps only
Sort into groups

Choose the Functions plan

Exam skills 4.1.4

Choose the Azure Functions hosting plan for each requirement.

Log in to try this activity Interactive activities are free with an account.

Durable Functions

Functions are stateless, but business processes often are not. Durable Functions adds stateful orchestrations written as code. An orchestrator calls activity functions, waits for results and survives restarts, as the framework checkpoints progress automatically. Common patterns include function chaining, in which steps run in sequence, fan-out/fan-in, which runs tasks in parallel and aggregates results, and human interaction, which waits for an external approval with a timeout.

Match the pairs

Durable Functions patterns

Exam skills 4.1.4

Match each Durable Functions pattern with its scenario.

Log in to try this activity Interactive activities are free with an account.

Azure Logic Apps

Azure Logic Apps automates workflows with a visual designer and hundreds of connectors for services such as Microsoft 365, Salesforce and SAP. It suits integration work: when an invoice arrives by email, extract it, post it to a finance system, and notify a manager. It suits people who prefer configuration to code.

Two models exist. A Consumption logic app is multitenant, holds one workflow per resource and charges per execution. A Standard logic app runs in a single-tenant environment, can hold many stateful and stateless workflows per resource, and supports virtual network integration and private endpoints. Scenarios that require private connectivity point to Standard.

Scenario questions

Functions or Logic Apps?

Exam skills 4.1.4

Choose between Functions and Logic Apps, and between Logic Apps models.

Log in to try this activity Interactive activities are free with an account.

Functions or Logic Apps

The two services overlap, and the following table recaps the difference. Many solutions use both, as a logic app can call a function for custom logic.

AttributeAzure FunctionsAzure Logic Apps
DevelopmentCode firstDesigner first
Best atCustom logic and data processingConnecting services through connectors
OrchestrationDurable Functions, written in codeWorkflow definitions
Typical userDevelopersIntegration specialists and developers

The following diagram compares two serverless choices for two different workflows.

Two serverless choices. The purchase-order workflow relies on connectors for email, Teams and the ERP system over a private network, so a Standard logic app; the custom Python fan-out of 5,000 parts and fan-in of results suits Durable Functions on a Flex Consumption plan, which scales quickly and has no 10-minute limit.
The scenario is illustrative.
Worked example

Selecting serverless services

A company receives purchase orders by email. A workflow must save attachments, wait for a manager's approval in Microsoft Teams, then call an ERP system through a private network. Separately, a data process must split a large file into 5,000 parts, process them in parallel using custom Python, and combine the results. What should you recommend?

The purchase order process relies on connectors for email, Teams and ERP integration, with private connectivity, so a Standard logic app is the suitable choice. A Consumption logic app would lack virtual network integration.

The data process is custom code with a fan-out/fan-in pattern, so Durable Functions on a Flex Consumption plan is suitable, as the plan scales quickly and has no 10-minute limit. Plain functions with no orchestration would have to track thousands of parallel results manually, and a legacy Consumption plan could hit its timeout.

Check yourself

A function behind HTTP runs for ten minutes. Why will the caller fail, on any plan?

Show answer

HTTP-triggered functions must respond within 230 seconds, so long work must be handed to a queue or orchestration.

Exam Tips

Remember for the exam

  • Flex Consumption is the recommended serverless plan; Consumption is legacy.
  • HTTP-triggered functions must respond within 230 seconds.
  • Durable Functions adds stateful orchestration: chaining, fan-out/fan-in and human interaction.
  • Logic Apps Standard supports private networking and many workflows per resource.