पाठ 8 / 25

Azure App Service

Host web apps and APIs without managing servers, using plans and deployment slots.

Platform as a service for web apps

Azure App Service runs web apps and APIs written in .NET, Java, Node.js, Python or PHP, or any custom container, on Windows or Linux. Azure handles OS patching, load balancing and TLS. You pay for an App Service plan, which defines the VM size and instance count; several apps can share one plan. Tiers matter: Free/Shared are for experiments, Basic adds custom domains, Standard and Premium add autoscale, deployment slots and VNet integration features. A deployment slot is a live copy of the app with its own hostname: deploy to staging, warm it up and test it, then swap with production for a near-zero-downtime release that you can swap back. Settings can be marked slot-specific so a staging database string never moves to production.

Deploy, then swap

az webapp up builds and deploys from the current folder; slots make the release reversible.

az appservice plan create -g rg-shop-dev-cin -n plan-shop --sku P1v3 --is-linux
az webapp create -g rg-shop-dev-cin -p plan-shop -n app-shop-api --runtime "PYTHON:3.12"

az webapp deployment slot create -g rg-shop-dev-cin -n app-shop-api --slot staging
# deploy the new build to staging, test https://app-shop-api-staging.azurewebsites.net

az webapp deployment slot swap -g rg-shop-dev-cin -n app-shop-api \
  --slot staging --target-slot production

A rehearsal stage

A deployment slot is a second stage behind the curtain. The new cast rehearses there with lights on; at showtime the stages rotate, and if anyone forgets their lines you rotate back.

त्वरित जाँच: What does a deployment slot swap give you?

  • A cheaper App Service plan
  • Automatic database migrations
  • A free custom domain
  • A warmed-up release that can be swapped back if it misbehaves
Answer

A warmed-up release that can be swapped back if it misbehaves — Slots let you validate and warm a release before routing production traffic to it, and swapping back is quick.