Lesson content
Read, practise, then check your understanding
Compute: Virtual Machines and App Service
Azure Virtual Machines provide Windows or Linux servers with control over images, sizes, disks, extensions, and networking. Azure App Service hosts web applications and APIs on a managed platform with deployment slots, autoscaling, certificates, and runtime integration.
Core ideas
- A VM size defines vCPU, memory, network, and optional accelerator characteristics.
- Virtual machine scale sets manage similar VM instances and support autoscaling and rolling updates.
- An App Service plan defines region, operating system, pricing tier, and compute shared by apps.
- Managed identities give VMs or apps Microsoft Entra credentials without storing passwords.
Design and operating model
Use VMs for legacy software, custom operating systems, specialized agents, or deep host control. Use App Service when an HTTP application fits its supported runtime and platform model. Automate patching or image replacement for VMs; for App Service, use deployment slots, health checks, scaling rules, and private connectivity where required.
Example
az webapp up \
--name replace-with-unique-training-app \
--resource-group learning-rg \
--location centralindia \
--runtime 'NODE:22-lts'
az webapp identity assign \
--name replace-with-unique-training-app \
--resource-group learning-rg
Run examples in a disposable training subscription. Replace names, Regions, identifiers, scopes, sizes, and policies with reviewed values, and confirm current Azure CLI and service requirements before production use.
Production guidance
- Keep persistent application data outside VM temporary disks and App Service local ephemeral storage.
- Use managed identity and Key Vault references instead of application credentials.
- Measure utilization and startup behavior before selecting VM size, App Service tier, or scaling thresholds.
The chapter quiz follows the lesson and checks both service vocabulary and architecture decisions.
Knowledge check
Answer every question correctly to complete this chapter.
0 of 10 checks passed
Your progress is saved on this device.