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
- Web applications (ASP.NET, Node.js, Python, PHP, Java, Ruby).
- REST APIs with predictable or variable load.
- Rapid deployment without managing servers.
- Teams that want built-in CI/CD, deployment slots, and auto-scaling.
App Service Plans
The App Service Plan defines the compute resources. Multiple apps can share one plan.
| Tier | Use Case | Features |
|---|---|---|
| Free / Shared | Dev, testing, learning | No SLA, shared infrastructure, limited resources |
| Basic (B1-B3) | Dev/test with dedicated VMs, no auto-scale | Dedicated VMs, manual scale |
| Standard (S1-S3) | Production workloads | Auto-scale, deployment slots (5), SLA |
| Premium (P1v3-P3v3) | High-performance production, VNet integration | More 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.
Commands
# 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
- Create a Free tier App Service Plan and deploy a sample Node.js or Python app.
- Upgrade to Standard S1 and create a staging slot.
- Deploy a change to staging, browse it, then perform a slot swap.
- Check application logs via
az webapp log tail. - Configure an autoscale rule on the App Service Plan.
Debugging Scenario
Issue: App returns HTTP 503 after deployment.
- Check Application Logs in Portal → App Service → Log stream.
- Run
az webapp log tailto stream logs live. - Check Kudu (Advanced Tools) → Process Explorer to see if the process is actually running.
- Common cause: wrong startup command or missing environment variable.
- Swap back to the previous slot while investigating.
Interview Questions
Beginner
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.
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
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.
Standard (S1+) or Premium. Free and Basic tiers do not carry an SLA.
Scenario-based
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.