Chapter 8 of 20
Azure Compute Services: VMs, Containers, and Serverless
Tour Azure’s main compute options—from virtual machines to containers and serverless functions—and see how to pick the right one for a given workload.
Big Picture: Azure Compute Choices
Where Compute Fits
You already saw Azure regions, region pairs, Availability Zones, datacenters, resources, resource groups, and subscriptions. Now you focus on one big resource category: compute.
Main Compute Options
For AZ-900, know these compute options: Azure Virtual Machines and VM Scale Sets, Azure App Service (including containers), Azure Kubernetes Service, Azure Container Instances, and Azure Functions.
Service Model Mapping
These align to cloud service models: VMs are IaaS, App Service is PaaS, and Azure Functions is a serverless Functions-as-a-Service style model.
Key Trade-offs
Compare options using manageability, scalability, cost model, and flexibility/control. Exam questions often hide the answer in these trade-offs.
Control vs Convenience
Visual spectrum: More control, more work → VMs → Containers/App Service → Serverless → Less control, less work.
Azure Virtual Machines and VM Scale Sets
What is a VM?
Azure Virtual Machines are IaaS: Azure gives you virtualized servers, storage, and networking; you manage the OS, patches, middleware, and apps.
When VMs Fit Best
Use VMs when you need full OS control, have legacy or specialized software, or are lifting and shifting existing on-premises servers to the cloud.
High Availability
Single VMs can fail. Use Availability Sets or spread VMs across Availability Zones in a region to improve resilience and uptime.
VM Scale Sets
Virtual Machine Scale Sets manage a group of identical VMs. Azure can automatically add or remove instances based on metrics like CPU load.
VM Cost Pattern
VMs charge for allocated capacity by time. Save using reserved instances or spot VMs, but you still pay even when the VM is mostly idle.
VMs in Practice: A Legacy App Migration
Scenario Setup
A company runs a legacy Windows Server app with custom COM components and drivers. The vendor has not modernized it for containers or PaaS.
Lift-and-Shift with VMs
They create an Azure VM with Windows Server, install the app and drivers, and replicate the on-prem setup in the cloud.
Adding Resilience
Two identical VMs go into an Availability Set behind an Azure Load Balancer so that if one VM fails, the other continues serving users.
Scaling with VM Scale Sets
Later, they create a VM Scale Set using a custom image. Azure can then scale out more identical VMs automatically as load grows.
Exam Clues
Phrases like “requires custom OS drivers” or “legacy app, minimal code changes” strongly suggest Azure Virtual Machines, not PaaS or serverless.
Containers and Azure Container Services
What Are Containers?
Containers package app code and dependencies into a portable unit. They share the host OS kernel, so they start quickly and use fewer resources than full VMs.
Azure Container Instances
Azure Container Instances let you run containers directly in Azure without managing servers. You specify an image and resources; Azure runs it on demand.
Azure Kubernetes Service
Azure Kubernetes Service (AKS) is a managed Kubernetes cluster that orchestrates many containers across VMs, handling deployment, scaling, and recovery.
Where Containers Fit
Containers sit between VMs and PaaS: more portable and flexible than PaaS, but with less OS management than raw VMs.
Exam Clues for Containers
If you see Docker images, Kubernetes, or container orchestration in a question, think AKS or Azure Container Instances rather than VMs or Functions.
Azure App Service and Web Apps (Including Containers)
What is Azure App Service?
Azure App Service is a PaaS platform for hosting web apps and APIs. Azure runs the infrastructure, OS, and runtime so you focus on your code.
Types of App Service
You will mainly see Web Apps for code-based sites and Web App for Containers for running your own Docker images as web apps.
What Azure Manages
Azure handles the underlying VMs, OS patching, load balancing, and platform updates. You configure scale-out rules if needed.
What You Manage
You manage your app code or container image, app settings, connection strings, and how and when to scale.
Exam Clues for App Service
Phrases like “host a web app with minimal infrastructure management and easy scaling” almost always point to Azure App Service.
Azure Functions and Serverless Compute
What is Serverless?
Serverless means you run code without managing servers. Azure still uses servers behind the scenes, but you never provision or patch them.
Azure Functions Basics
Azure Functions lets you write small functions triggered by events such as HTTP requests, timers, queue messages, or blob uploads.
Key Characteristics
Functions are event-driven, scale automatically, and in the consumption plan you pay only for execution time and number of executions.
Good Use Cases
Use Functions for background jobs, lightweight APIs, and glue logic that connects services when specific events occur.
Exam Clues for Functions
Look for phrases like “run code on demand”, “no infrastructure management”, and “scale from zero” to identify Azure Functions.
Thought Exercise: Matching Workloads to Compute Options
Use this step as a mental exercise. For each scenario, pause and decide which Azure compute option fits best before reading the suggested answer.
- Scenario A: You need to host a simple marketing website for a product launch. It is a standard web app, and the team wants to deploy quickly with minimal infrastructure management.
- Your pick? (Think: web app, minimal management.)
- Suggested answer: Azure App Service (Web App).
- Scenario B: A data processing job must run whenever a new image is uploaded to Azure Blob Storage. It should scale automatically if many images are uploaded at once, and you want to pay only when processing occurs.
- Your pick? (Think: event-driven, pay-per-use.)
- Suggested answer: Azure Functions.
- Scenario C: You have a complex legacy ERP system requiring a specific Windows Server configuration and custom drivers. Rewriting it is not currently possible.
- Your pick? (Think: legacy, OS control.)
- Suggested answer: Azure Virtual Machines.
- Scenario D: Your team already uses Docker and wants to deploy a microservices-based application that must be portable across multiple clouds.
- Your pick? (Think: containers, orchestration.)
- Suggested answer: Azure Kubernetes Service (AKS).
After you answer, ask yourself: Which trade-offs (manageability, scalability, cost, control) pushed you toward that choice? That reasoning is exactly what AZ-900 questions test.
Quick Check: Pick the Right Compute Service (1)
Test your understanding of Azure compute selection.
A startup wants to build an HTTP-based API that can handle unpredictable spikes in traffic. They do not want to manage servers and prefer a pay-per-execution billing model. Which Azure service is the best fit?
- Azure Virtual Machines with a Virtual Machine Scale Set
- Azure Kubernetes Service (AKS)
- Azure App Service (Web App)
- Azure Functions (consumption plan)
Show Answer
Answer: D) Azure Functions (consumption plan)
Azure Functions in the consumption plan is designed for event-driven, HTTP-triggered workloads with automatic scaling and pay-per-execution billing. VM Scale Sets and AKS still require server management. App Service can auto-scale but typically bills for reserved capacity, not per execution.
Quick Check: Pick the Right Compute Service (2)
Another scenario-based question to reinforce compute choices.
Your company is migrating a .NET web application that currently runs on IIS on-premises. The app uses standard features only and does not require custom OS-level components. The team wants to reduce OS management effort while keeping deployment simple. Which Azure service is the most appropriate?
- Azure Virtual Machines
- Azure App Service (Web App)
- Azure Functions
- Azure Container Instances
Show Answer
Answer: B) Azure App Service (Web App)
Azure App Service (Web App) is ideal for hosting standard web applications like .NET apps without custom OS requirements. It reduces OS management compared to VMs. Azure Functions is better for event-driven functions, not full web apps. Container Instances run containers but do not provide as many web-focused PaaS features as App Service.
Flashcards: Core Azure Compute Concepts
Use these flashcards to reinforce key terms and when to use each compute option.
- Azure Virtual Machine (VM)
- An Infrastructure as a Service (IaaS) compute option where Azure provides virtualized hardware, storage, and networking, and you manage the operating system, patches, middleware, and applications.
- Virtual Machine Scale Set (VMSS)
- An Azure service that manages a group of load-balanced, identical VMs, enabling automatic scale-out and scale-in based on demand using a common VM template.
- Azure App Service (Web App)
- A Platform as a Service (PaaS) offering for hosting web applications and APIs, where Azure manages the underlying infrastructure, OS, and runtime, and you focus on your app code and configuration.
- Web App for Containers
- An App Service feature that lets you deploy and run your own Docker container images as web apps, combining container flexibility with PaaS management benefits.
- Azure Functions
- Azure's serverless compute service that runs small pieces of code (functions) in response to events, automatically handling scaling and infrastructure, with pay-per-execution billing in the consumption plan.
- Azure Container Instances (ACI)
- A service for running containers directly in Azure without managing servers or orchestration, suitable for simple or short-lived container workloads.
- Azure Kubernetes Service (AKS)
- A managed Kubernetes service that orchestrates containers across a cluster of VMs, providing deployment, scaling, and self-healing for containerized applications.
- Best fit for legacy apps needing OS control
- Azure Virtual Machines, possibly with Availability Sets or Virtual Machine Scale Sets for resilience and scaling.
- Best fit for standard web apps with minimal management
- Azure App Service (Web App), which abstracts infrastructure and OS management while providing easy scaling and deployment features.
- Best fit for event-driven, pay-per-use code
- Azure Functions, especially in the consumption plan, which runs code only when triggered and scales automatically.
Putting It Together: Trade-offs and Exam Patterns
Manageability vs Control
VMs give maximum control but most management. Containers and AKS are in the middle. App Service and Functions give least management overhead.
Scalability Spectrum
VMs scale via manual changes or VM Scale Sets. App Service provides built-in auto-scale. Functions scale automatically from zero based on events.
Cost Considerations
VMs and App Service plans usually bill for allocated capacity. Functions in consumption and some container uses bill mainly per execution or usage.
Common Exam Patterns
Legacy OS control → VMs; web app with minimal management → App Service; Docker and orchestration → AKS/ACI; event-driven pay-per-use → Functions.
Next Study Steps
As you tackle the next diagnostic and mock exam, watch for these clue phrases. Your gap guide will highlight which compute trade-offs you should revisit.
Key Terms
- container
- A lightweight, standalone package that includes an application and all its dependencies, sharing the host operating system kernel while remaining isolated from other containers.
- Azure Functions
- Azure's serverless compute service that runs small pieces of code (functions) in response to events, automatically handling scaling and infrastructure, with pay-per-execution billing in the consumption plan.
- Azure App Service
- A Platform as a Service (PaaS) offering for hosting web applications, REST APIs, and backends, where Azure manages the underlying infrastructure, OS, and runtime.
- serverless compute
- A cloud execution model where the cloud provider automatically manages infrastructure, provisioning, and scaling, and customers are typically billed based on actual usage rather than pre-allocated capacity.
- Azure Virtual Machine (VM)
- An Infrastructure as a Service (IaaS) compute option where Azure provides virtualized hardware, storage, and networking, and you manage the operating system, patches, middleware, and applications.
- Azure Kubernetes Service (AKS)
- A managed Kubernetes service that orchestrates containers across a cluster of VMs, providing deployment, scaling, and self-healing for containerized applications.
- Azure Container Instances (ACI)
- A service for running containers directly in Azure without managing servers or orchestration, suitable for simple or short-lived container workloads.
- Virtual Machine Scale Set (VMSS)
- An Azure service that manages a group of load-balanced, identical VMs, enabling automatic scale-out and scale-in based on demand using a common VM template.