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
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
| Feature | VMs | Containers | Functions | App Service |
|---|---|---|---|---|
| Service type | IaaS | IaaS/PaaS | Serverless (PaaS) | PaaS |
| You manage | OS, apps, data | App and dependencies | Just code | App code and config |
| Startup time | Minutes | Seconds | Milliseconds | Seconds |
| Scaling | Manual or Scale Sets | Kubernetes or manual | Automatic (0 to thousands) | Built-in auto-scale |
| Cost model | Per-second running | Per-second running | Per-execution | Per-hour (plan-based) |
| Best for | Legacy apps, full OS control | Microservices, portable apps | Event-driven, intermittent tasks | Web 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.
| Feature | VM | Container |
|---|---|---|
| Includes OS? | Yes β full OS per VM | No β shares host OS kernel |
| Size | Gigabytes | Megabytes |
| Startup | Minutes | Seconds |
| Isolation | Hardware-level | Process-level |
| Density | 10-20 per physical host | 100s per physical host |
Azure container services
| Service | What It Does | Best For |
|---|---|---|
| Azure Container Instances (ACI) | Run a single container quickly β no orchestration | Simple tasks, dev/test, batch jobs |
| Azure Kubernetes Service (AKS) | Orchestrate hundreds of containers at scale | Microservices, 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:
| Trigger | Example |
|---|---|
| HTTP request | API endpoint that processes form submissions |
| Timer | Run a cleanup script every night at midnight |
| Queue message | Process an order when a message arrives |
| Blob storage | Generate 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
| Character | Need | Best Compute Option |
|---|---|---|
| Summit Construction | Legacy project management app on Windows Server | VMs β needs full OS control |
| Kai | Web API for university project, intermittent traffic | Azure Functions β serverless, near-zero cost |
| Peak Roasters | Online ordering website, needs to be always-on | App Service β managed web hosting, easy deployment |
| Harbour Health | Microservices architecture for patient portal | AKS (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
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?
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.