Question

Difficulty: EasyConfigure Azure App Service Web Apps

You are deploying a web application to an Azure App Service web app that has a production slot and a staging deployment slot. The application requires a database connection string defined in its application settings. You must ensure that the staging slot always connects to the staging database and the production slot always connects to the production database, even after you perform a slot swap. Which configuration should you apply to the connection string setting?

  1. Mark the setting as a deployment slot setting.Answer
  2. B
    Configure the setting as a Key Vault reference using a system-assigned managed identity.
  3. C
    Configure the setting in the App Service Plan configuration.
  4. D
    Configure the setting as a User-Assigned Managed Identity reference.

Answer

Mark the setting as a deployment slot setting.
Marking the configuration as a deployment slot setting ensures that the database connection string is sticky to the slot. When you perform a slot swap, Azure swaps all settings that are not marked as deployment slot settings, but leaves slot-specific settings untouched, keeping the staging slot connected to the staging database and the production slot connected to the production database.

Step-by-Step Solution

1
Identify the configuration settings that must remain specific to each environment (the staging database vs the production database).
The database connection string is identified as the environment-specific configuration.
This determines which configurations need to be prevented from swapping.
2
Navigate to the configuration section of the Azure App Service Web App in the Azure Portal or use the Azure CLI.
Access is gained to the application settings key-value pairs.
You must edit the settings definition to apply the slot-specific constraint.
3
Edit the connection string setting and select the checkbox for 'Deployment slot setting' (or use the '--slot-settings' parameter in the Azure CLI).
The setting is marked as sticky to the slot.
This ensures that when a swap occurs, the value of the setting stays with the slot and does not move to the other slot.

Key Concept

Deployment Slot Settings (Sticky Settings)
Rate this question