Lab 11 – Azure App Service
Objectives
- Create an App Service plan and web app
- Configure deployment slots and slot swapping
- Configure application/connection-string settings, scaling, and autoscale
- Configure custom domains and TLS (overview), and diagnostics logging
Prerequisites
Estimated time
35 minutes
Part 1 – App Service plan and web app
❗important
Deployment slots are only available on Standard tier and above. Free and Shared tiers do not support slots.
- Search for App Services > Create > Web App.
- Basics tab:
- Resource group: Create new rg-az104-lab11
- Name: app-az104lab11-
- Publish: Code
- Runtime stack: Node 20 LTS
- Operating System: Linux
- Region: East US
- App Service Plan section: Create new plan
- Name: plan-az104lab11
- SKU and size: Standard (S1) (required for deployment slots)
- Review + create > Create.
Browse the app
- Go to the app > Overview > copy the Default domain (e.g.,
app-az104lab11-.azurewebsites.net).
- Open it in a browser — shows the default App Service welcome page.
Part 2 – App settings & connection strings
- Open the app > Configuration (under Settings).
- Application settings tab > + New application setting:
- Name: ENVIRONMENT, Value: lab, Deployment slot setting:
unchecked (applies to all slots)
- Name: FEATUREFLAGX, Value: true
- Connection Strings tab > + New connection string:
- Name: DefaultConnection
- Value: Server=tcp:example.database.windows.net;Database=demo;
- Type: SQLAzure
- Deployment slot setting: unchecked
- Save > Continue (if prompted about restarting the app).
These settings are injected into the app's environment at runtime.
Part 3 – Deployment slots
- Open the app > Deployment slots (under Deployment) > + Add slot.
- Name:
staging, Clone settings from: select the production slot (or
leave unchecked). Add.
- This creates a
staging slot with its own subdomain (e.g.,
app-az104lab11--staging.azurewebsites.net).
Deploy different content to staging
(Example: upload a simple HTML file or a zipped app package.)
- Go to the staging slot > Deployment Center (or Advanced Tools >
Kudu SSH console).
- Or, use the Zip Deploy feature: go to the slot > Deployment Center >
choose Zip Deploy > upload a .zip containing your app code.
Swap staging into production
ℹ️tip
Use the Preview swap feature first to verify the staging slot is working as expected before swapping to production.
- Go to the app's Deployment slots > select
staging > Swap (top toolbar).
- Source:
staging, Target: production. Swap.
- The slots exchange DNS names —
staging now serves the production URL, and
vice versa. This swap is near-instant (no downtime).
Slot-specific settings: if a setting is marked Deployment slot
setting, it does NOT swap — useful for keeping staging pointed at a test
database while production points at the prod database.
Part 4 – Scale up (plan tier) and scale out (instance count)
Scale up (vertical)
- Open the app > Scale up (App Service plan) (under Settings).
- Select a higher SKU (e.g., Standard (S2) or Premium (P1v3)) > Apply.
This increases CPU/RAM per instance.
Scale out (horizontal)
- Open the app > Scale out (App Service plan) (under Settings).
- Increase Instance count to 2 or 3 > Save.
This adds more instances behind the app's load balancer.
- Go to Monitor > Autoscale settings (in the Azure Portal sidebar, or
search for Autoscale settings).
- Create autoscale setting:
- Resource group: rg-az104-lab11
- Resource name: plan-az104lab11
- Resource type: App Service plans
- Autoscale setting name:
autoscale-app11.
- Default: minimum 1, maximum 3, current 1.
- Add a rule:
- Metric: CPU Percentage
- Operator: Greater than
- Threshold: 70
- Duration: 5 minutes
- Operation: Increase count by 1
- Save.
Now the App Service plan scales out automatically when CPU exceeds 70%.
Part 5 – Diagnostics logging
- Open the app > App Service logs (under Monitoring).
- Application logging: set Level to Information. Filesystem or
Blob Storage (Filesystem for quick testing).
- Web server logging: Filesystem > Retention period: 35 days.
- Save.
- Log stream (under Monitoring) shows real-time logs from the app.
Part 6 – Custom domains & TLS (overview)
- Custom domains (under Settings):
- To add a custom domain, you need a DNS provider and a TLS certificate.
- Create a CNAME record (your-domain.com → app-az104lab11-.azurewebsites.net).
- Add the domain in the Portal > Custom domains > Add custom domain.
- Bind a certificate via TLS/SSL settings (use App Service Managed
Certificate, which is free for custom domains).
- TLS/SSL settings (under Settings):
- Bind a certificate (managed or self-signed).
- Set HTTPS Only to enforce HTTPS.
- Set Minimum TLS version (e.g., TLS 1.2).
Skip actual domain purchase and certificate binding in this lab — just
understand where these settings live.
Part 7 – Backup & restore (overview)
- Backups (under Settings) — requires Standard tier or higher.
- Create a backup target (storage account + container).
- Configure a scheduled backup including the connected database if present.
- Restore a backup by selecting it > Restore.
Backup setup is available on Standard tier and above.
Validation
- [ ] Web app reachable via default hostname
- [ ] App settings (ENVIRONMENT, FEATUREFLAGX) and connection string configured
- [ ] Staging slot created and accessible via separate subdomain
- [ ] Slot swap succeeds (staging and production exchange DNS names)
- [ ] Plan scaled up (higher SKU) and out (more instances)
- [ ] Autoscale rule created based on CPU percentage
- [ ] Application logs visible via Log stream
Cleanup
- Resource groups > select
rg-az104-lab11 > Delete resource group.
Exam Tips
- Deployment slots are available on Standard tier and above; "swap" is near-instant and avoids downtime — slot-specific app settings/connection strings don't swap if marked sticky.
- Scaling up = change SKU/tier (more CPU/RAM/features per instance). Scaling out = more instances. Autoscale only does scale out/in, never SKU changes.
HTTPS Only and minimum TLS version are common security exam scenarios.
- App Service supports deployment from: ZIP/WAR deploy, local Git, GitHub Actions/Azure DevOps CI/CD, container images (Web App for Containers).