Lab 11 – Azure App Service

Objectives

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.

  1. Search for App Services > Create > Web App.
  2. 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

  1. App Service Plan section: Create new plan

- Name: plan-az104lab11

- SKU and size: Standard (S1) (required for deployment slots)

  1. Review + create > Create.

Browse the app

  1. Go to the app > Overview > copy the Default domain (e.g.,

app-az104lab11-.azurewebsites.net).

  1. Open it in a browser — shows the default App Service welcome page.

Part 2 – App settings & connection strings

  1. Open the app > Configuration (under Settings).
  2. Application settings tab > + New application setting:

- Name: ENVIRONMENT, Value: lab, Deployment slot setting:

unchecked (applies to all slots)

- Name: FEATUREFLAGX, Value: true

  1. Connection Strings tab > + New connection string:

- Name: DefaultConnection

- Value: Server=tcp:example.database.windows.net;Database=demo;

- Type: SQLAzure

- Deployment slot setting: unchecked

  1. Save > Continue (if prompted about restarting the app).

These settings are injected into the app's environment at runtime.

Part 3 – Deployment slots

  1. Open the app > Deployment slots (under Deployment) > + Add slot.
  2. Name: staging, Clone settings from: select the production slot (or

leave unchecked). Add.

  1. 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.)

  1. Go to the staging slot > Deployment Center (or Advanced Tools >

Kudu SSH console).

  1. 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.

  1. Go to the app's Deployment slots > select staging > Swap (top toolbar).
  2. Source: staging, Target: production. Swap.
  3. 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)

  1. Open the app > Scale up (App Service plan) (under Settings).
  2. Select a higher SKU (e.g., Standard (S2) or Premium (P1v3)) > Apply.

This increases CPU/RAM per instance.

Scale out (horizontal)

  1. Open the app > Scale out (App Service plan) (under Settings).
  2. Increase Instance count to 2 or 3 > Save.

This adds more instances behind the app's load balancer.

Configure autoscale

  1. Go to Monitor > Autoscale settings (in the Azure Portal sidebar, or

search for Autoscale settings).

  1. Create autoscale setting:

- Resource group: rg-az104-lab11

- Resource name: plan-az104lab11

- Resource type: App Service plans

  1. Autoscale setting name: autoscale-app11.
  2. Default: minimum 1, maximum 3, current 1.
  3. Add a rule:

- Metric: CPU Percentage

- Operator: Greater than

- Threshold: 70

- Duration: 5 minutes

- Operation: Increase count by 1

  1. Save.

Now the App Service plan scales out automatically when CPU exceeds 70%.

Part 5 – Diagnostics logging

  1. Open the app > App Service logs (under Monitoring).
  2. Application logging: set Level to Information. Filesystem or

Blob Storage (Filesystem for quick testing).

  1. Web server logging: Filesystem > Retention period: 35 days.
  2. Save.
  3. Log stream (under Monitoring) shows real-time logs from the app.

Part 6 – Custom domains & TLS (overview)

  1. Custom domains (under Settings):

- To add a custom domain, you need a DNS provider and a TLS certificate.

- Create a CNAME record (your-domain.comapp-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).

  1. 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)

  1. Backups (under Settings) — requires Standard tier or higher.
  2. Create a backup target (storage account + container).
  3. Configure a scheduled backup including the connected database if present.
  4. Restore a backup by selecting it > Restore.

Backup setup is available on Standard tier and above.

Validation

Cleanup

  1. Resource groups > select rg-az104-lab11 > Delete resource group.

Exam Tips