DevOps Peach

Azure Basics · PaaS Compute – App Service, Container Instances and AKS · Lesson 2 of 5

Creating Web Apps, CI/CD and Deployment Slots

A web app runs on a plan with a runtime stack or container; CI/CD deploys automatically from GitHub/Azure DevOps; deployment slots let you deploy to staging and swap to production with no downtime.

Practice interactively →

App Service is PaaS: the platform handles the OS, patches, load balancing and scaling. A web app has a unique name <name>.azurewebsites.net (custom domains can be mapped), publishes code (pick a runtime stack: .NET, Java, Node.js, Python, PHP) or a container, on Linux or Windows. API/Mobile Apps are now part of Web Apps; Functions is a separate service built on App Service.

Runtimes use the FRAMEWORK:VERSION format listed by az webapp list-runtimes (for example NODE:22-lts, PYTHON:3.12).

Continuous deployment: connect GitHub, Bitbucket or Azure Repos (or GitHub Actions/Azure Pipelines) — a push makes the app pick up the new build.

flowchart LR
  G["GitHub push"] --> ST["Slot staging<br/>app-devops-lab-01-staging.azurewebsites.net"]
  ST -- "test, warm-up" --> SW{"Swap"}
  SW --> PR["Production<br/>app-devops-lab-01.azurewebsites.net"]
  PR -. "rollback: swap back" .-> ST

Deployment slots

Command Meaning
az webapp create -g rg-devops-lab -p plan-lab -n app-devops-lab-01 --runtime "NODE:22-lts" Create a web app
az webapp deployment slot create -g rg-devops-lab -n app-devops-lab-01 --slot staging Create a slot
az webapp deployment slot swap -g rg-devops-lab -n app-devops-lab-01 --slot staging --target-slot production Swap

Ways to deploy

Method Command or setting Notes
ZIP deploy az webapp deploy -g rg-devops-lab -n app-devops-lab-01 --src-path app.zip --type zip Simple and scriptable
Container image az webapp config container set ... --container-image-name acrdevopslab.azurecr.io/web:1.4 Pull from ACR with a managed identity
GitHub Actions or Azure Pipelines Deployment Center Build, test, then deploy to a slot
Local Git or FTP Deployment Center FTP should be disabled when not needed

Run from package (WEBSITE_RUN_FROM_PACKAGE=1) mounts the ZIP read-only instead of extracting it, which makes deployments atomic and startup faster. Every app also has a Kudu site at <name>.scm.azurewebsites.net with deployment logs, a file browser, and a console.

Safer swaps

Testing in production

Traffic routing sends a percentage of production users to another slot:

az webapp traffic-routing set -g rg-devops-lab -n app-devops-lab-01 --distribution staging=10

Users are pinned to a slot by a cookie, so their session stays consistent. Watch error rates in Application Insights, then swap fully or set the share back to zero.

Containers on App Service

For a custom container, set WEBSITES_PORT when the app listens on a port other than 80 or 8080, and enable continuous deployment for the image tag so a new push in ACR restarts the app with the new image.

Practice interactively →