ComputeLesson 3 of 16

Azure App Services

App Service is Azure's managed PaaS for hosting web apps, REST APIs, and mobile backends — with zero OS management and built-in scaling, CI/CD, and deployment slots.

Simple Explanation

Think of App Service as a managed apartment: Azure owns the building (OS, patching, infrastructure). You just deploy your app code and it runs.

When to Use App Service

App Service Plans

The App Service Plan defines the compute resources. Multiple apps can share one plan.

TierUse CaseFeatures
Free / SharedDev, testing, learningNo SLA, shared infrastructure, limited resources
Basic (B1-B3)Dev/test with dedicated VMs, no auto-scaleDedicated VMs, manual scale
Standard (S1-S3)Production workloadsAuto-scale, deployment slots (5), SLA
Premium (P1v3-P3v3)High-performance production, VNet integrationMore CPU/RAM, 20 slots, VNet
Isolated (I1-I3)Compliance, dedicated network (ASE)App Service Environment, private networking

Deployment Slots

Slots let you deploy to a staging environment, test, then swap to production with zero downtime. Standard tier and above include slots.

Deployment Slot Swap Flow
Production Slot
v1.0 (serving traffic)
Staging Slot
v2.0 (deploy + test)
Swap
Instant (no downtime)
Production ← v2.0
Staging ← v1.0 (rollback ready)

Commands

Azure CLI
# Create App Service Plan (Standard S1)
az appservice plan create \
  --name asp-web-prod \
  --resource-group rg-web \
  --sku S1 \
  --is-linux

# Create a web app (Node.js 18)
az webapp create \
  --resource-group rg-web \
  --plan asp-web-prod \
  --name myapp-prod-2024 \
  --runtime "NODE:18-lts"

# Deploy from GitHub
az webapp deployment source config \
  --resource-group rg-web \
  --name myapp-prod-2024 \
  --repo-url https://github.com/org/repo \
  --branch main \
  --manual-integration

# Create a staging deployment slot
az webapp deployment slot create \
  --resource-group rg-web \
  --name myapp-prod-2024 \
  --slot staging

# Swap staging to production
az webapp deployment slot swap \
  --resource-group rg-web \
  --name myapp-prod-2024 \
  --slot staging \
  --target-slot production

# View live logs
az webapp log tail --resource-group rg-web --name myapp-prod-2024

# Set app settings (environment variables)
az webapp config appsettings set \
  --resource-group rg-web \
  --name myapp-prod-2024 \
  --settings "NODE_ENV=production" "DB_HOST=sql.database.windows.net"

Hands-on

  1. Create a Free tier App Service Plan and deploy a sample Node.js or Python app.
  2. Upgrade to Standard S1 and create a staging slot.
  3. Deploy a change to staging, browse it, then perform a slot swap.
  4. Check application logs via az webapp log tail.
  5. Configure an autoscale rule on the App Service Plan.

Debugging Scenario

Issue: App returns HTTP 503 after deployment.

Interview Questions

Beginner

What is an App Service Plan?

The compute resource backing one or more App Service apps. It defines VM size, OS, region, and tier. Multiple apps can share a single plan to save cost.

What is a deployment slot?

A separate live environment (e.g., staging) within the same App Service where you deploy and test before swapping to production with zero downtime.

Intermediate

Why use App Service over a VM?

No OS patching, built-in auto-scale, deployment slots, integrated CI/CD, and much lower operational overhead. Use VMs only when OS-level control is required.

What tier is required for production SLA?

Standard (S1+) or Premium. Free and Basic tiers do not carry an SLA.

Scenario-based

You need zero-downtime deploys with instant rollback capability.

Use deployment slots: deploy to staging, test, swap to production. The old production becomes staging for rollback.

Summary

App Service is the go-to PaaS for web apps and APIs on Azure. It eliminates OS management, supports all major runtimes, and provides enterprise features like slots, auto-scale, and VNet integration at Standard tier and above.