Azure Architecture Guide

CH20-04: Compute and Container Services

Goal

Compute services run code. The hard part is not asking whether a service can run the workload. Many services can. The architecture question is which runtime gives the right balance of control, scaling, deployment model, team skill, reliability, and operations.

The durable idea is:

Compute selection is responsibility matching: choose the runtime whose control, scaling, and operating model fit the workload.

The Short Version

Start with the execution model:

Workload NeedCommon Azure Direction
Managed web app or APIAzure App Service.
Event-triggered unit of workAzure Functions.
Managed containers without direct Kubernetes operationsAzure Container Apps.
Kubernetes APIs, ecosystem, and platform standardizationAzure Kubernetes Service.
Full OS control or legacy runtimeAzure Virtual Machines.
Fleet of similar VMsVirtual Machine Scale Sets.
Large parallel jobsAzure Batch.
Static frontend with integrated deploymentAzure Static Web Apps.

Service Reference

ServicePurposeUse WhenAvoid WhenCommon Prompt
Azure App ServiceManaged hosting for web apps, APIs, and background web workloads.You want managed platform hosting without managing VMs or Kubernetes.You need deep OS control, custom cluster behavior, or specialized runtime dependencies.Can managed web hosting run this workload?
Azure FunctionsEvent-driven serverless compute.Work is triggered by events, timers, queues, HTTP, or automation and can be packaged as units of work.The workload has long-running, stateful, tightly coupled, or platform-heavy requirements that do not fit the execution model.Is this event-triggered work?
Azure Container AppsManaged container hosting with serverless-style scaling and microservice support.You want to run containers without owning a Kubernetes control plane.You need full Kubernetes APIs, custom operators, deep cluster control, or a mature Kubernetes platform standard.Do containers need Kubernetes ownership?
Azure Kubernetes ServiceManaged Kubernetes control plane for container platforms.The organization needs Kubernetes APIs, ecosystem tools, platform standardization, or complex container orchestration.The team is not prepared to own cluster operations, security, networking, upgrades, and platform reliability.Is Kubernetes justified by platform needs?
Azure Virtual MachinesInfrastructure as a service compute with OS-level control.You need legacy compatibility, custom OS configuration, specialized software, or lift-and-shift migration.Managed hosting or containers would meet the need with less operational burden.Do we need OS control?
Virtual Machine Scale SetsManaged group of identical VMs with scaling.You need scalable VM fleets, custom images, or VM-based worker pools.A managed app, container, or serverless service can absorb the work.Do we need a scalable VM fleet?
Azure BatchManaged scheduling for large-scale parallel and batch computing jobs.You need pools of compute for parallel jobs, rendering, simulations, or batch processing.You are hosting normal web APIs or always-on services.Is this large parallel batch work?
Azure Static Web AppsHosting for static frontends and integrated serverless APIs.You need static site hosting for frontend apps with simple deployment and global distribution.The app needs complex server-side runtime control.Is this mostly a static frontend?

Commonly Confused Services

ComparisonShort Answer
App Service vs VMsApp Service reduces platform operations for web apps; VMs give OS control with more responsibility.
Functions vs App ServiceFunctions fit event-triggered units of work; App Service fits web apps and APIs with a more traditional hosting model.
Container Apps vs AKSContainer Apps runs containers with less platform ownership; AKS fits when Kubernetes itself is the platform requirement.
AKS vs VMsAKS manages container orchestration; VMs give direct server control. Both still need operations.
Batch vs FunctionsBatch fits large parallel jobs; Functions fits event-triggered units of work.

Architecture Patterns

Compute services often appear in patterns such as:

  • Managed web application with App Service, Application Gateway or Front Door, Azure SQL, Key Vault, and Azure Monitor.

  • Event-driven processing with Functions and Service Bus or Event Grid.

  • Microservices on Container Apps when the team wants containers without owning Kubernetes.

  • Enterprise Kubernetes platform on AKS with platform engineering ownership.

  • Lift-and-shift modernization with VMs first, then gradual migration to managed hosting or containers.

  • Parallel job processing with Azure Batch and storage-backed inputs and outputs.

Cloud Comparison

AWS and GCP users can translate roughly by responsibility: managed app hosting, functions, containers, Kubernetes, VMs, and batch compute exist in all major clouds. But direct mapping is incomplete. The real choice is about the operating model your team accepts.

For example, "the app uses containers" does not automatically mean AKS. Containers can run on Container Apps, App Service, AKS, or other hosting choices depending on control, scale, networking, deployment, and platform ownership.

Common Mistakes

  • Choosing AKS because the application uses containers.

  • Choosing serverless without considering execution duration, cold starts, dependencies, and observability.

  • Defaulting to VMs when managed hosting would reduce operations.

  • Ignoring deployment, scaling, incident response, and cost model.

  • Splitting an application into many functions before understanding ownership and workflow boundaries.

  • Underestimating platform work for Kubernetes networking, identity, upgrades, policies, and observability.

If Someone Asks You

How do I choose Azure compute services quickly?

A good answer is:

Choose compute by execution model and responsibility. App Service is a strong starting point for managed web apps and APIs. Functions fits event-triggered units of work. Container Apps runs containers with less Kubernetes ownership. AKS is for teams that need Kubernetes APIs and can operate the platform. VMs fit OS control and legacy needs. Batch fits large parallel jobs. Static Web Apps fits static frontends.

What You Should Remember

Choose compute by execution model, control needs, scaling behavior, team skill, and operations.

Questions to Check Understanding

  1. When is App Service a better starting point than VMs?

  2. Why does AKS require platform ownership?

  3. When might Container Apps be enough for microservices?