Question

Difficulty: MediumConfigure Azure App Service Web Apps

You are developing an Azure App Service web app named webapp-prod that has a deployment slot named staging. The application uses an app setting named DbConnection to store its database connection string. You need to configure the application so that the DbConnection setting remains slot-specific and does not change slots during a swap operation. Which Azure CLI command should you run?

  1. az webapp config slot-settings set --name webapp-prod --resource-group rg-prod --app-settings DbConnectionAnswer
  2. B
    az webapp config appsettings set --name webapp-prod --resource-group rg-prod --settings DbConnection --slot-settings DbConnection
  3. C
    az webapp deployment slot update --name webapp-prod --resource-group rg-prod --slot staging --settings DbConnection
  4. D
    az webapp config slot-settings set --name webapp-prod --resource-group rg-prod --connection-strings DbConnection

Answer

The command 'az webapp config slot-settings set --name webapp-prod --resource-group rg-prod --app-settings DbConnection' is correct.
The correct command uses the 'az webapp config slot-settings set' command with the '--app-settings' parameter to specify that the 'DbConnection' setting should remain sticky to the slot and not be swapped.

Step-by-Step Solution

1
Identify the type of setting to make slot-specific.
The setting is defined as an app setting (DbConnection) rather than a connection string.
This determines whether to use the --app-settings or --connection-strings parameter.
2
Select the correct Azure CLI subgroup for configuring slot-specific (sticky) settings.
The correct subgroup is 'az webapp config slot-settings'.
Standard 'az webapp config appsettings' is for editing app setting values, not for configuring stickiness.
3
Construct and run the CLI command specifying the app settings to keep sticky.
az webapp config slot-settings set --name webapp-prod --resource-group rg-prod --app-settings DbConnection
This registers 'DbConnection' as a slot-specific setting for the webapp-prod app.

Key Concept

Azure App Service deployment slot settings stickiness configuration
Rate this question