Tutorials Logic, IN info@tutorialslogic.com

Azure App Service: Web Apps, Deployment Slots, and Scaling

App Service Plan and Runtime

Azure App Service hosts web applications and APIs while Azure manages the underlying web platform, operating-system patching, health infrastructure, and deployment integration.

The App Service plan determines compute capacity and major features; the web app contains code, settings, identity, domains, networking, and deployment configuration.

A reliable App Service release uses immutable artifacts, slot-specific configuration, health checks, managed identity, and a tested slot swap or rollback procedure.

Choose an operating system, runtime, Region, and plan tier that support the required scaling, networking, slots, and certificates. Multiple apps on one plan share its compute resources.

  • Watch CPU and memory contention between apps on the same plan.
  • Use a supported runtime version and plan upgrades before end of support.
  • Scale out for concurrency before using larger instances blindly.

Configuration and Identity

Store non-secret settings in App Service configuration and retrieve secrets from Key Vault using managed identity. Mark environment-specific slot settings so they do not move during a swap.

  • Do not place secrets in source-controlled configuration.
  • Use Azure RBAC for downstream resource access.
  • Validate startup when a required setting or secret is unavailable.

Domains and Network Paths

Configure custom domains and TLS, then decide whether inbound access is public, access-restricted, or private. VNet integration provides outbound connectivity and does not by itself make the app private.

  • Use private endpoints when private inbound access is required.
  • Restrict downstream firewalls to the actual outbound design.
  • Verify DNS behavior for private endpoints.

Slots, Health, and Diagnostics

Deploy to a staging slot, warm it, run smoke tests, and swap only after health succeeds. Application Insights, App Service logs, metrics, and deployment logs should explain failed startup or requests.

  • Test swap behavior for sticky and non-sticky settings.
  • Use a health endpoint that checks critical readiness.
  • Keep a rollback route to the previous artifact or slot.

Plan Capacity Boundary

An App Service plan supplies compute capacity and feature availability to the apps and slots placed on it. Apps on the same plan share worker instances, scale behavior, and contention risk even though they are separate web-app resources. Group them only when shared capacity, ownership, operating system, Region, and failure impact are acceptable.

Choose Windows, Linux, or custom-container hosting and a plan tier that supports the required deployment slots, VNet integration, zone redundancy, private endpoints, certificates, and scaling. Feature and regional support changes over time, so verify the exact plan and Region rather than relying on a generic App Service checklist.

Measure CPU, memory working set, request queue, response time, file-system use, connections, and downstream latency per app. Moving one noisy app to a separate plan can be safer than scaling every app together. Include staging slots in temporary and steady capacity calculations.

  • Treat the plan as a shared compute and failure boundary.
  • Verify required features on the selected tier and Region.
  • Separate apps with incompatible ownership or scaling needs.
  • Include slots in capacity and cost estimates.

Runtime and Artifact Contract

Select a supported built-in runtime version or deploy a controlled container image. Track end-of-support dates and test upgrades with native dependencies, startup commands, certificates, time zones, and file paths. The platform patches its hosting layer, while the application team remains responsible for code and package vulnerabilities.

Build an immutable artifact once and promote the same package or image through environments. Avoid deployment mechanisms that rebuild from a moving branch on the production app. Record source commit, build, artifact digest, runtime, and release identity so logs and rollback point to exact bytes.

App Service local file storage has platform-specific persistence and sharing behavior and should not become an accidental system of record. Put durable user data in Storage or a database, keep temporary files bounded, and test application behavior across restart, scale-out, and instance replacement.

  • Track runtime support as application work.
  • Promote the same tested artifact through environments.
  • Keep durable state outside worker-local storage.
  • Publish release identity into diagnostics.

Settings, Identity, and Key Vault

App settings are exposed to the application as configuration and are encrypted by the platform at rest, but they remain readable to sufficiently privileged resource administrators. Store ordinary non-secret configuration there and use managed identity with Key Vault for secrets that need separate control, rotation, and audit.

A system-assigned identity follows the app or slot resource, while a user-assigned identity has an independent lifecycle. Managed identity is configured per slot. Grant the identity narrow data roles at downstream resources and coordinate role propagation before swapping traffic to a revision that requires new access.

Key Vault references reduce secret copying but do not remove network, identity, version, refresh, or availability design. Mark environment-specific settings as deployment-slot settings, validate every required value during startup, and make missing secret behavior fail clearly without printing the secret.

  • Use managed identity for downstream Azure access.
  • Treat slot identities and settings independently.
  • Give secret rotation a running-app refresh plan.
  • Fail startup safely when required configuration is missing.

Inbound and Outbound Paths

A custom domain and certificate establish the public name and TLS path, while access restrictions, private endpoints, built-in authentication, Front Door, or Application Gateway shape inbound access. A private endpoint gives a private inbound address; it does not configure the applications outbound path.

VNet integration sends supported outbound traffic from the app into a delegated subnet so it can reach private endpoints, databases, or controlled egress. Plan subnet capacity, routes, DNS, NAT or firewall, and service endpoints. VNet integration by itself does not make the public app endpoint private.

Private DNS must return the correct private address from integrated and connected networks. Test name resolution and TLS from the running app, not only from a portal test. Record outbound addresses or route-all behavior only as part of the selected architecture, because scaling and network configuration can affect the source path.

  • Design inbound and outbound networking separately.
  • Use private endpoints for private inbound access.
  • Plan VNet integration subnet capacity and DNS.
  • Verify connectivity from the actual app instance.

Slot Release Sequence

A deployment slot is a live app with its own hostname, configuration, identity, and potentially shared plan capacity. Deploy the candidate artifact to staging, apply slot-specific settings, warm startup paths and dependencies, run smoke tests, then preview or perform the swap according to the release procedure.

During a swap, selected configuration moves while settings marked as slot settings remain. Authentication, managed identity, network, Key Vault references, caches, and background jobs need explicit testing because a healthy HTTP page may not prove the full application is ready. Prevent both slots from processing the same scheduled or queue work unless duplicate handling is designed.

Swap back can restore routing to the old slot, but it cannot undo database writes, external messages, or incompatible schema. Use expand-and-contract changes and preserve the old revisions configuration until the observation window ends. Record which app and slot own the production hostname after every release.

  • Warm and test the staging slot through its real dependencies.
  • Mark environment-specific settings as sticky intentionally.
  • Prevent duplicate background processing across slots.
  • Keep data changes compatible with swap-back.

Scale, Health, and Recovery

Scale up changes worker capability; scale out adds instances. Choose autoscale signals tied to demand and downstream capacity, set safe minimum and maximum counts, and account for warm-up. Session affinity can hide stateful design and distribute load unevenly, so keep session state in a shared durable service where practical.

Configure a health-check path that proves application readiness without making one shared dependency outage recycle every worker. Application Insights and Azure Monitor should cover request rate, failure, latency percentiles, dependency calls, exceptions, worker saturation, restarts, and deployment markers. Set log retention and redact request data.

Exercise failed startup, unavailable Key Vault, broken private DNS, dependency slowdown, bad slot swap, scale-out, and plan restart. Verify rollback and data compatibility. App Service reduces server operations, but production ownership still includes runtime support, application security, network paths, capacity, telemetry, and recovery.

  • Scale from demand and dependency limits.
  • Keep session state outside individual workers.
  • Design health checks against correlated failure.
  • Test slot rollback with real data dependencies.

App Service Support Check

Before each release, verify the App Service runtime, operating system, plan generation, TLS policy, certificate, networking features, deployment extension, and Application Insights integration remain supported. Test a plan or runtime upgrade in a slot or representative app, including startup, native packages, managed identity, private DNS, and swap behavior.

  • Track runtime and plan retirement notices.
  • Test upgrades against the real network and identity path.

App Service Release Examples

Azure App Service deployment slots example

Deployment slots let you validate a new build before traffic is switched, which is one of the safest production patterns in App Service.

Azure App Service deployment slots example
az webapp deployment slot create \
  --resource-group rg-cloud-lab \
  --name app-web-prod \
  --slot staging
az webapp deployment slot swap \
  --resource-group rg-cloud-lab \
  --name app-web-prod \
  --slot staging \
  --target-slot production
  • Slots reduce deployment risk and support quick rollback.
  • Keep staging settings isolated if they differ from production settings.

Swap a Slot With Configuration Safety

A release uses a staging slot but one secret and one connection string must remain production-specific.

Swap a Slot With Configuration Safety
Constraints: Slot settings must not move; warm-up must complete before traffic switches; rollback must be quick.
Decision: Mark environment-specific values as slot settings, validate staging health, swap with preview, then complete the swap.
Verification: Production keeps its secret references, the new build is warm, and the old build remains available in staging.
Failure test: Break the staging health endpoint and confirm the swap is stopped before customer traffic moves.
Output
Expected evidence: Production keeps its secret references, the new build is warm, and the old build remains available in staging.
  • This is a worked engineering decision, so the result is operational evidence rather than terminal output.
Before you move on

Azure App Service: Web Apps, Deployment Slots, and Scaling Mastery Check

5 checks
  • The App Service plan supports required features and capacity.
  • Secrets are retrieved with managed identity.
  • Inbound and outbound network behavior is understood.
  • Slot settings and health checks are verified before swap.
  • Logs and Application Insights identify failed releases.
Browse Free Tutorials

Explore 500+ free tutorials across 20+ languages and frameworks.