Question

Difficulty: MediumConfigure Azure App Service Web Apps

You manage an Azure App Service web app named `app-catalog` that contains a production slot and a deployment slot named `staging`. The application uses an application setting named `DatabaseConnectionString` to connect to a database.

You must configure the web app to meet the following requirements:
- The staging slot must always connect to the staging database, and the production slot must always connect to the production database, even after a swap operation.
- The web app must perform a custom warm-up request to the path `/api/warmup` before the slot swap completes.

Which two configuration steps should you perform? (Select two.)

  1. Configure DatabaseConnectionString as a deployment slot setting.Answer
  2. Add an application setting named WEBSITE_SWAP_WARMUP_PING_PATH and set its value to /api/warmup.Answer
  3. C
    Add a Key Vault reference named DatabaseConnectionString with the syntax @Microsoft.AppConfiguration(Endpoint=https://kv-catalog.vault.azure.net/secrets/dbconn).
  4. D
    Configure the autoscale rules to trigger a scale-out event using a Memory Percentage metric whenever a swap is initiated.

Answer

To configure the database connection strings to remain slot-specific and to specify a custom warm-up path, you must configure the DatabaseConnectionString setting as a deployment slot setting and add an application setting named WEBSITE_SWAP_WARMUP_PING_PATH with the value /api/warmup.
Marking the connection string as a deployment slot setting ensures it stays with the respective slot (staging connects to staging DB, production connects to production DB) after a swap. Setting the WEBSITE_SWAP_WARMUP_PING_PATH environment variable ensures that App Service performs the warm-up request to the custom path before routing production traffic to the new instance.

Step-by-Step Solution

1
Identify the mechanism to prevent app settings from swapping.
Determine that marking DatabaseConnectionString as a deployment slot setting (sticky setting) keeps the connection string bound to the slot during swaps.
By default, App Service swaps all non-sticky app settings between the staging and production slots. Marking it as a deployment slot setting prevents this.
2
Identify the setting for configuring a custom warmup path.
Determine that the WEBSITE_SWAP_WARMUP_PING_PATH app setting allows you to specify a custom endpoint for warm-up pings.
By default, App Service pings the root path (/). Specifying a path in WEBSITE_SWAP_WARMUP_PING_PATH allows a targeted warm-up of specific endpoints.

Key Concept

Configuring deployment slots and slot swap behaviors in Azure App Service.
Rate this question