Compute Types: VMs, Containers and Functions

Your data
Application
Runtime
Operating system
Virtualisation
Servers and storage
Networking
Datacenter

You manageMicrosoft manages
From full control to no servers at all: VMs, containers and functions trade control for simplicity.

😟 THE PROBLEM

Every workload runs on big VMs, even tiny jobs that run twice a day.

😊 THE SOLUTION

Match each workload to the lightest compute type: VM, container or function.

  • Legacy app needs full OS control✓ Virtual machine
  • Microservices must start fast and move easily✓ Containers
  • A tiny job runs on an event✓ Azure Functions
🛠️ Solved with: VMs · Containers · Functions
Try it yourself in the Azure simulator No Azure account needed. Launch a VM and save money 🖥️ Try it ❯
Module 2: Architecture & Services ⏱ 7 min read Updated 11 Nov 2026

Quick answer

Azure offers three main compute types. Virtual machines virtualise hardware and give you a full operating system to control. Containers package an app with its dependencies and share the host OS kernel, so they are lightweight and start in seconds. Functions run small pieces of event-driven code with no servers to manage, billed per execution.

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

Do you need a whole house, a caravan, or just a tent?

A house gives you everything but takes ages to build. A caravan is quick to move and has what you need. A tent is up in a minute for one night. Azure compute is the same choice: VMs, containers or functions.

Explain it like I’m 10

The technical explanation

Virtual machines

  • Full guest OS you manage
  • Minutes to start
  • Any software, any configuration
  • Billed while allocated
  • Azure Virtual Machines, VM Scale Sets

Containers

  • App plus dependencies, shared kernel
  • Seconds to start
  • Portable between environments
  • Billed for running containers
  • Container Instances, Container Apps, AKS

Functions

  • Just your code
  • Event-triggered
  • No servers to manage
  • Pay per execution (consumption plans)
  • Azure Functions
Three ways to run code on Azure

Real-world business scenario

Food delivery

A food delivery platform

The problem
It ran everything on VMs: a legacy billing engine, the ordering microservices and small notification jobs, with lots of idle capacity.
What they used
Kept billing on VMs, moved microservices to containers on Azure Container Apps, and moved notifications to Azure Functions.
Why that choice
Each workload got the lightest compute type that fits its needs.
The result
Less patching, faster deployments, and lower costs for spiky notification traffic.

When to use it and when not to

✓ Use it when…

  • **VMs** for legacy or custom software needing OS control.
  • **Containers** for portable microservices and consistent environments.
  • **Functions** for short, event-driven tasks.

✕ Think twice when…

  • VMs for tiny jobs that run a few times a day.
  • Functions for long-running, stateful processing.
Ready for more?The full lesson adds the technical explanation, when to use it, interview questions and revision notes.

Interview preparation

Say your answer out loud first, then open the model answer. Interviewers care more about your reasoning than the exact words.

Beginner Explain the difference between a VM, a container and a function.

Model answer

A VM is a whole computer with its own operating system that I manage. A container is a lightweight package of just my app and its dependencies that shares the host's OS, so it starts quickly. A function is a small piece of code that runs only when an event happens, with no servers to manage at all.

Intermediate Why are containers more lightweight than VMs?

Model answer

VMs virtualise hardware, so each one boots a full guest OS. Containers virtualise the operating system: they share the host kernel and only package the app and its libraries. That makes them smaller, faster to start and denser on the same hardware.

Experienced developer How would you pick between AKS, Azure Container Apps and Azure Functions for a new microservices system?

Model answer

Functions for event-driven glue and short tasks. Container Apps for containerised microservices when I want serverless scaling, including to zero, without running Kubernetes myself. AKS when I need full Kubernetes control, custom networking, operators or very large scale and have the skills to run it. I would start with the most managed option that meets the requirements.

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.

Question 1

Question 1 of 3

Which compute type packages an app with its dependencies and shares the host OS kernel?

Question 2

Question 2 of 3

You need to run code each time a message arrives in a queue, without managing servers. Which option fits best?

Question 3

Question 3 of 3

Which compute type gives you the most control over the operating system?

Quick revision

Key points

  • VMs = full OS control, most management (IaaS).
  • Containers = lightweight, portable, fast start, share the host OS kernel.
  • Functions = event-driven, serverless, pay per execution.
  • Container services include Container Instances, Container Apps and AKS.

Important terminology

Virtual machine
Software emulation of a physical computer with its own full OS (IaaS).
Container
A lightweight package of an app and its dependencies that shares the host's OS kernel.
Azure Functions
Serverless, event-driven compute that runs code on demand.
Orchestration
Automatically deploying, scaling and healing many containers, for example with Kubernetes.

Common mistakes

  • Saying containers include a full OS like a VM.

Exam tips

  • "Run code when an event happens, no servers" = Azure Functions.
  • "Package an app with dependencies, start in seconds" = containers.

Five quick revision questions

  1. 1.Which compute type gives full control of the OS?Show

    Virtual machines.

  2. 2.What do containers share with their host?Show

    The operating system kernel.

  3. 3.Which compute type is event-driven and serverless?Show

    Azure Functions.

  4. 4.Which Azure service orchestrates many containers with Kubernetes?Show

    Azure Kubernetes Service (AKS).

  5. 5.Which is the quickest way to run a single container?Show

    Azure Container Instances.

Official references

Make it stick: play a quick gameSort It, Match the Pairs, Lightning Round and Who Am I? Earn XP and badges. Play ❯

Finished this lesson? Tick it off. Your progress is saved in this browser.

Next up: Azure Virtual Machines