Domain 2 β€” Module 4 of 11 36%
11 of 26 overall
Domain 2: Describe Azure Architecture and Services Free ⏱ ~12 min read

Azure Compute: Containers, Functions, and App Service

VMs aren't the only compute option. Azure offers containers for portable apps, Functions for serverless code, and App Service for managed web hosting. Here's when to use each.

Beyond VMs β€” more ways to run code

Simple explanation

Think of three ways to ship a product.

Virtual machines = renting a whole warehouse. You control everything inside, but you pay for the entire space even if you only fill half of it.

Containers = shipping containers. Your product is packaged with everything it needs. You can move the container to any ship (any server) and it works the same everywhere.

Functions (serverless) = a courier service. You hand over the package, they deliver it. You don’t own a warehouse or a shipping container β€” you just pay per delivery.

Each approach gives you less control but less to manage.

Compute options compared

Azure compute options compared
FeatureVMsContainersFunctionsApp Service
Service typeIaaSIaaS/PaaSServerless (PaaS)PaaS
You manageOS, apps, dataApp and dependenciesJust codeApp code and config
Startup timeMinutesSecondsMillisecondsSeconds
ScalingManual or Scale SetsKubernetes or manualAutomatic (0 to thousands)Built-in auto-scale
Cost modelPer-second runningPer-second runningPer-executionPer-hour (plan-based)
Best forLegacy apps, full OS controlMicroservices, portable appsEvent-driven, intermittent tasksWeb apps, APIs, mobile backends

Containers β€” portable and lightweight

A container packages an application with everything it needs to run β€” code, libraries, runtime, and settings. Unlike a VM, a container doesn’t include a full operating system β€” it shares the host OS kernel.

FeatureVMContainer
Includes OS?Yes β€” full OS per VMNo β€” shares host OS kernel
SizeGigabytesMegabytes
StartupMinutesSeconds
IsolationHardware-levelProcess-level
Density10-20 per physical host100s per physical host

Azure container services

ServiceWhat It DoesBest For
Azure Container Instances (ACI)Run a single container quickly β€” no orchestrationSimple tasks, dev/test, batch jobs
Azure Kubernetes Service (AKS)Orchestrate hundreds of containers at scaleMicroservices, complex applications

Kai’s startup side-project uses ACI to run a web scraper container. It starts in seconds, runs for 2 minutes, and costs fractions of a cent. No VM needed.

Azure Functions β€” serverless compute

Azure Functions run small pieces of code in response to events β€” an HTTP request, a timer, a message in a queue, a file upload.

Key characteristics:

  • Event-driven β€” code runs when triggered, not continuously
  • Auto-scaling β€” from zero to thousands of instances
  • Pay-per-execution β€” first 1 million executions/month are free
  • Stateless by default β€” each execution is independent

Common triggers:

TriggerExample
HTTP requestAPI endpoint that processes form submissions
TimerRun a cleanup script every night at midnight
Queue messageProcess an order when a message arrives
Blob storageGenerate a thumbnail when an image is uploaded
Durable Functions

Standard Azure Functions are stateless β€” they don’t remember previous executions. Durable Functions extend this with stateful workflows:

  • Chain multiple functions together
  • Wait for external events
  • Run parallel operations and aggregate results

The AZ-900 exam rarely goes this deep, but know that β€œstateless” has an exception with Durable Functions.

Azure App Service β€” managed web hosting

App Service is the PaaS web hosting platform in Azure. You deploy your code; Azure handles the server, OS, scaling, and patching.

Supports: .NET, Java, Node.js, Python, PHP, Ruby, and custom containers

Features:

  • Built-in auto-scaling and load balancing
  • CI/CD integration (GitHub, Azure DevOps)
  • Custom domains and SSL certificates
  • Deployment slots (test in staging before swapping to production)

Choosing the right compute for each character

CharacterNeedBest Compute Option
Summit ConstructionLegacy project management app on Windows ServerVMs β€” needs full OS control
KaiWeb API for university project, intermittent trafficAzure Functions β€” serverless, near-zero cost
Peak RoastersOnline ordering website, needs to be always-onApp Service β€” managed web hosting, easy deployment
Harbour HealthMicroservices architecture for patient portalAKS (containers) β€” orchestrated container platform
Exam tip: Matching scenarios to compute

The exam loves β€œwhich compute option should you use?” questions. Key patterns:

  • β€œLegacy app” or β€œspecific OS” β†’ VM
  • β€œWithout managing servers” or β€œdeploy code only” β†’ App Service or Functions
  • β€œEvent-driven” or β€œruns occasionally” β†’ Functions
  • β€œMicroservices” or β€œportable across environments” β†’ Containers (ACI or AKS)
  • β€œWeb app” or β€œREST API” β†’ App Service
  • β€œBatch processing at scale” β†’ Containers or Functions

🎬 Video walkthrough

Flashcards

Question

How are containers different from VMs?

Click or press Enter to reveal answer

Answer

Containers share the host OS kernel and package only the app and its dependencies. They're smaller (MBs vs GBs), start faster (seconds vs minutes), and you can run hundreds on one host. VMs include a full OS and provide hardware-level isolation.

Click to flip back

Question

What is Azure App Service?

Click or press Enter to reveal answer

Answer

A fully managed PaaS for hosting web apps, REST APIs, and mobile backends. Supports multiple languages (.NET, Java, Node.js, Python, PHP, Ruby). Azure handles the OS, patching, scaling, and load balancing.

Click to flip back

Question

When should you use Azure Functions?

Click or press Enter to reveal answer

Answer

For event-driven, intermittent workloads β€” code that runs in response to triggers (HTTP requests, timers, queue messages). Best when you want zero cost when idle and automatic scaling.

Click to flip back

Question

What is Azure Kubernetes Service (AKS)?

Click or press Enter to reveal answer

Answer

A managed container orchestration service for deploying and managing containerised applications at scale. Best for microservices architectures with many containers that need load balancing, scaling, and self-healing.

Click to flip back

Knowledge Check

Knowledge Check

Kai wants to build a small API that runs occasionally β€” processing 50-100 requests per day. They want the cheapest option with no server management. Which Azure compute service is BEST?

Knowledge Check

Harbour Health is building a new patient portal using a microservices architecture with 12 independent services. Which compute option is BEST suited?


Next up: Azure Networking β€” virtual networks, subnets, and VNet peering.