Azure App Service
Azure App Service is a fully managed platform for hosting web apps and APIs. You bring the code; Azure handles servers, patching and load balancing.
On this page · 5 min · Beginner
On this page
- Learning objectives
- Explanation
- Code example
- Step by step
- Real-world use
- Common mistakes
- Best practices
- Remember this
- Practice exercise
- Mini quiz
- Related topics
- My notes
- Reading time
- 5 min
- Difficulty
- Beginner
- Updated
- Oct 1, 2026
Related tutorials
Learning objectives#
- Explain App Service plans and apps
- Create and deploy an app with the Azure CLI
- Configure app settings and connection strings
- Use deployment slots and scaling
Explanation#
An App Service plan defines the compute — region, instance size and count. One or more apps run inside a plan and share its resources and cost.
App settings in Azure override appsettings.json at runtime and are exposed as environment variables. Store secrets in Key Vault and reference them from app settings.
Deployment slots (Standard tier and above) let you deploy to a staging slot, warm it up, then swap it into production with no downtime — and swap back if something goes wrong.
Code example: Deploy an ASP.NET Core API with the Azure CLI#
# Sign in and create a resource group
az login
az group create --name rg-techie-demo --location centralindia
# Create a Linux App Service plan (B1 = Basic tier)
az appservice plan create --name plan-techie-demo --resource-group rg-techie-demo \
--sku B1 --is-linux
# Create the web app on .NET 9
az webapp create --name techie-demo-api --resource-group rg-techie-demo \
--plan plan-techie-demo --runtime "DOTNETCORE:9.0"
# Configure settings (become environment variables)
az webapp config appsettings set --name techie-demo-api --resource-group rg-techie-demo \
--settings ASPNETCORE_ENVIRONMENT=Production
# Publish and deploy
dotnet publish -c Release -o ./publish
cd publish && zip -r ../app.zip . && cd ..
az webapp deploy --name techie-demo-api --resource-group rg-techie-demo --src-path app.zip --type zip
The API is available at https://techie-demo-api.azurewebsites.net
This example is illustrative. Copy or download it and run it in your own environment; the expected output is shown above.
Step-by-step explanation#
- A resource group holds everything for the project, so you can delete it all at once.
- The plan sets the size (B1) and OS (Linux).
- webapp create creates the app inside the plan with the .NET 9 runtime.
- App settings configure the environment without changing code.
- dotnet publish builds a release package; az webapp deploy uploads it.
Real-world use case#
Hosting an ASP.NET Core Web API for a React front end, with staging slots for safe releases and autoscale for traffic peaks.
Common mistakes#
Committed config files leak. Use App Service settings with Key Vault references and managed identity.
Plans are billed while they exist, even with no traffic. Delete the resource group when done: az group delete -n rg-techie-demo.
Best practices#
- Use managed identity to access other Azure resources
- Enable Application Insights
- Use deployment slots for zero-downtime releases
- Set a budget alert on the subscription
- Automate deployments with GitHub Actions or Azure Pipelines
Remember this#
App Service = managed hosting for web apps and APIs.
App settings override appsettings.json.
Deployment slots = deploy to staging, then swap.
Practice exercise#
Your task: Add a connection string named Default to the web app using the CLI.
Show solution
az webapp config connection-string set --name techie-demo-api --resource-group rg-techie-demo \
--connection-string-type SQLAzure --settings Default="<your-connection-string>"
Mini quiz#
What does an App Service plan determine?
Want more? Practise all Microsoft Azure MCQs · Microsoft Azure interview questions
My notes#
Saved in this browser.