Containers & AKSLesson 13 of 16

When to Use What

Azure offers multiple compute options for containers. This lesson builds a complete decision matrix across ACI, AKS, App Service (containers), and Azure Functions — so you always recommend the right service.

The Compute Decision Tree

Choose the Right Compute
Is it event-driven?
Short-lived?
YES → Azure Functions
NO → Continue
Need web app / REST API
No container required?
YES → App Service
NO → Continue
Containerized?
Long-running service?
Short jobs → ACI
Microservices/scale → AKS
Full OS control
Legacy app?
YES → VM or VMSS

Full Comparison Matrix

FeatureAzure FunctionsApp ServiceACIAKSVM/VMSS
ModelServerlessPaaSContainerKubernetesIaaS
StartupCold start (ms-sec)SecondsSecondsMinutes (cluster)Minutes
OS managementNoneNoneNonePartial (nodes)Full
ScalingAuto (to 0)Auto (plan-based)ManualHPA + KEDAVMSS autoscale
PersistenceStatelessStateless/StatefulEphemeralPVC supportFull disk
NetworkingVNet (Premium)VNet integrationVNet optionalFull CNIFull
Cost modelPer executionPer plan tierPer secondNode VMs + mgmtPer VM hour
ComplexityLowLowLowHighHigh
Best forEvents, triggersWeb apps, APIsBatch, CI jobsMicroservicesLegacy, OS-control

Containers: ACI vs AKS vs App Service (Container)

All three can run Docker containers. The difference is operational complexity and capability:

Use ACI when:

Use App Service (Container) when:

Use AKS when:

The Most Important Guideline

Don't start with AKS because of hype. AKS is powerful but carries significant operational complexity. For most teams with under 10 services, App Service handles containerized workloads with far less effort. Reach for AKS when the team is Kubernetes-proficient and the workload genuinely needs its capabilities.

Real-world Combinations

Production architectures mix multiple services based on the work each component does:

ScenarioFrontendAPIBackground WorkData
Startup web appStatic Website (Blob)App ServiceFunctionsAzure SQL
Enterprise microservicesCDN + BlobAKSFunctions / ACICosmos DB + SQL MI
Data pipelineN/AFunctionsACI batch jobsBlob + Azure SQL
Legacy migrationVM (IIS)VMVMSSSQL MI

Going Deeper on AKS

AKS is covered in full detail — cluster creation, networking, RBAC, CI/CD integration, and monitoring — in the dedicated AKS module. This lesson gives you the decision framework; the AKS module covers operational depth.

→ Go to the AKS Course Module

Interview Questions

Beginner

What is the simplest way to run a container in Azure?

Azure Container Instances (ACI) — one CLI command, no cluster to manage. Runs the container and exits.

Scenario-based

You have a user-facing API, a background image processor, and a nightly report generator. What compute for each?

API → App Service (managed PaaS, auto-scale, slots for deployments). Image processor → Azure Functions with Blob trigger (event-driven, serverless). Report generator → Azure Function with Timer trigger or ACI batch job (runs nightly, exits).

When would you choose AKS over App Service for microservices?

When you have 5+ services needing service mesh, Kubernetes-native config management, stateful workloads, team has k8s expertise, and you need fine-grained auto-scaling via KEDA.

Summary

Azure Functions for events, App Service for web apps, ACI for short container jobs, AKS for microservices at scale, VMs for full OS control. Most real-world architectures combine several of these. Start with the simplest option that meets the requirement — complexity can always be added, but rarely removed easily.