Lessons in this course (14)

3. Azure App Service

Basic★ Must knowLesson 3 of 14

PaaS for web apps and APIs (.NET, Java, Node, Python, PHP; Windows or Linux; code or containers).

  • App Service plan = the VMs you pay for (tier: Free/Basic/Standard/Premium v3/Isolated v2); many apps can share a plan.
  • Features: deployment slots (staging → swap for zero downtime), autoscale (scale out instances) and scale up (bigger SKU), custom domains + managed TLS certificates, Easy Auth (built-in authentication), VNet integration and private endpoints, health check path, always on, backups, WebJobs.
  • Configuration: App settings and connection strings become environment variables (override appsettings.json); Key Vault references @Microsoft.KeyVault(SecretUri=...).
bash
az appservice plan create -g rg-shop -n plan-shop --sku P1v3 --is-linux
az webapp create -g rg-shop -p plan-shop -n app-shop-api --runtime "DOTNETCORE:10.0"
az webapp identity assign -g rg-shop -n app-shop-api
az webapp config appsettings set -g rg-shop -n app-shop-api --settings ASPNETCORE_ENVIRONMENT=Production
az webapp deploy -g rg-shop -n app-shop-api --src-path publish.zip --type zip
az webapp deployment slot swap -g rg-shop -n app-shop-api --slot staging