Question

Difficulty: MediumConfigure Azure App Services

You manage an Azure App Service web app named WebApp1 that has a deployment slot named Staging. WebApp1 currently connects to a production database, and Staging connects to a testing database. The database connection settings are stored as an application setting named DB_CONNECTION.

You need to ensure that when Staging is swapped to production, the production slot continues to connect to the production database and the Staging slot continues to connect to the testing database.

Which configuration should you apply?

  1. A
    Upgrade the App Service Plan pricing tier to Premium V3 to enable multi-slot configuration synchronization.
  2. B
    Configure an autoscale rule to dynamically modify the DB_CONNECTION setting based on slot status.
  3. Configure the DB_CONNECTION setting as a deployment slot setting in both WebApp1 and Staging.Answer
  4. D
    Configure an Azure Monitor alert action group to run an automation runbook that rewrites the settings after every swap.

Answer

Configure the DB_CONNECTION setting as a deployment slot setting in both WebApp1 and Staging.
The correct option is correct because configuring a setting as a deployment slot setting (also known as a slot-sticky setting) pins that specific configuration to the slot. When the deployment slots are swapped, the app code and most configurations are exchanged, but settings marked as deployment slot settings remain unchanged in their respective slots. This ensures the production slot continues pointing to the production database, and the Staging slot continues pointing to the testing database.

Step-by-Step Solution

1
Identify how Azure App Service handles configuration settings during a slot swap.
By default, application settings and connection strings are swapped along with the slot content.
This allows settings to travel with the codebase unless explicitly configured otherwise.
2
Determine the configuration required to keep a setting slot-specific.
Marking the setting as a 'deployment slot setting' (slot-sticky) prevents it from being swapped.
This pins the database connection setting to each respective environment (production vs. testing).
3
Apply this configuration to the target setting in both the production slot and the Staging slot.
The DB_CONNECTION setting remains tied to its slot after the swap.
This ensures the production slot continues pointing to the production database, and the Staging slot continues pointing to the testing database.

Key Concept

App Service Deployment Slot Settings (Sticky Settings)
Estimated Time:1m 30s
Rate this question