Azure Functions
😟 THE PROBLEM
A VM runs all day just to handle a few events an hour.
😊 THE SOLUTION
Run the code as an Azure Function triggered by the event.
- Paying for an idle server✓ Pay per execution
- Sudden bursts of events✓ Scales out automatically
- Lots of plumbing code✓ Bindings connect data declaratively
Quick answer
Azure Functions is Azure's serverless compute service. You write small pieces of code that run in response to triggers such as HTTP requests, timers, queue messages or new files. Azure provides and scales the compute automatically, and on consumption-style plans you pay only while your code runs.
Exam objective: 2.2.1 Compare compute types, including containers, virtual machines, and functions. (Skills measured as of July 20, 2026)
Start with a question
Why keep a server running all day to resize five photos an hour?
You don’t have to. Azure Functions wakes up when a photo arrives, resizes it, and goes back to sleep.
Explain it like I’m 10
The technical explanation
-
1 Trigger
HTTP request, timer, queue message, new blob, database change…
-
2 Your code
C#, JavaScript, Python, Java, PowerShell and more.
-
3 Output binding
Write to a queue, a database or storage, declaratively.
Hosting plans include Flex Consumption (recommended serverless plan, scale to zero, optional always-ready instances), Premium (pre-warmed instances) and Dedicated (App Service plan).
Real-world business scenario
A food delivery app
- The problem
- Order confirmations were sent by a VM that sat mostly idle but crashed at dinner peaks.
- What they used
- An Azure Function triggered by a queue message for every new order.
- Why that choice
- Event-driven, automatic scaling, pay per execution.
- The result
- Confirmations keep up with peaks, and costs fell to near zero off-peak.
When to use it and when not to
✓ Use it when…
- Event-driven tasks, webhooks, scheduled jobs and glue code.
✕ Think twice when…
- Constant heavy traffic where an always-on service is cheaper.
- Very long-running processing.
Interview preparation
Say your answer out loud first, then open the model answer. Interviewers care more about your reasoning than the exact words.
Beginner What is Azure Functions?
Model answer
A serverless service that runs small pieces of code when something happens, like a file upload or an HTTP request, without me managing any servers.
Intermediate What are triggers and bindings?
Model answer
A trigger is what starts the function, and every function has exactly one. Bindings are optional input and output connections to other services, like reading a blob or writing to a queue, declared in configuration instead of written in code.
Experienced developer How do you handle long-running workflows with Functions?
Model answer
Use Durable Functions, which add orchestrations with checkpoints and replay, patterns such as function chaining, fan-out/fan-in and human interaction, and survive restarts. For very long or heavy jobs, consider Container Apps jobs or Batch instead.
Test yourself with exercises
3 original practice questions in the AZ-900 style. Pick your answers, then check them. You will see why each option is right or wrong. Score 75% or more and this topic is marked complete.
Quick revision
Key points
- Functions = serverless, event-driven code.
- Triggers start functions; bindings connect data.
- Scales automatically, including to zero.
- Pay per execution on consumption-style plans.
Important terminology
- Trigger
- The event that starts a function, such as an HTTP call, a timer or a new blob.
- Binding
- A declarative connection to input or output data, such as writing to a queue, without extra code.
- Stateless
- A function keeps no data between runs unless you store it elsewhere; Durable Functions adds stateful workflows.
Common mistakes
- Using Functions for long-running, CPU-heavy processing without Durable Functions or a suitable plan.
Exam tips
- "Run code in response to an event, without managing servers" = Azure Functions.
Five quick revision questions
-
1.What starts an Azure Function?Show
A trigger.
-
2.How many triggers does a function have?Show
Exactly one.
-
3.What are bindings?Show
Declarative connections to input or output data.
-
4.How are you usually billed on a consumption-style plan?Show
Per execution and resources used while running.
-
5.What adds stateful workflows to Functions?Show
Durable Functions.
Official references
Finished this lesson? Tick it off. Your progress is saved in this browser.