AZ-204 Practice Question: Deployment slot sticky settings prevent database…
An App Service application uses a staging deployment slot connected to a staging database and a production slot connected to a production database. Both use an app setting called 'DbConnectionString'. After a slot swap, the production slot starts using the staging database connection string. What configuration change prevents this?
⚠ Common exam trap
A common mix-up: candidates think Key Vault references or different naming conventions solve the swap issue, but they overlook that the fundamental problem is the setting being non-sticky and moving with the swap, which only the 'deployment slot setting' flag can prevent.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Mark the 'DbConnectionString' app setting as a deployment slot setting (sticky) so it remains bound to its slot across all swaps
Marking the 'DbConnectionString' app setting as a deployment slot setting (also called a sticky setting) ensures that the setting remains bound to its slot during a swap. When a slot swap occurs, Azure App Service automatically moves non-sticky app settings and connection strings to the target slot, but sticky settings are excluded from the swap and stay with their original slot. This prevents the production slot from accidentally picking up the staging database connection string after the swap.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Mark the 'DbConnectionString' app setting as a deployment slot setting (sticky) so it remains bound to its slot across all swaps
Why this is correct
Sticky settings are slot-specific. When slots swap, the code moves but sticky settings stay with the slot they were defined in. The staging slot retains its staging DbConnectionString and the production slot retains its production DbConnectionString permanently, regardless of how many swaps occur.
- ✗
Store the connection string in Azure Key Vault and reference it via a Key Vault reference in both slots
Why it's wrong here
Key Vault references retrieve secrets at runtime, but the secret name or URI in the app setting still swaps with the slot unless the app setting itself is marked as sticky. The Key Vault reference does not inherently prevent the setting from swapping.
- ✗
Use different app setting names for each slot (e.g., 'StagingDbConnectionString' and 'ProductionDbConnectionString') and swap code manually
Why it's wrong here
Using different names requires code changes to reference the correct setting name and breaks the clean staging/production separation. The sticky setting mechanism is the purpose-built solution — it allows the same name with slot-specific values.
- ✗
Disable slot swaps and use a CI/CD pipeline to deploy directly to production instead
Why it's wrong here
Disabling deployment slot swaps and deploying directly to production via a CI/CD pipeline negates the primary benefits of Azure App Service deployment slots. This approach eliminates the crucial zero-downtime deployment capability, as there is no pre-warmed staging environment to swap into production. It also removes the ability to easily roll back to a previously swapped version, making deployments riskier and less resilient. The problem of slot-specific connection strings is best addressed by marking the setting as sticky, preserving the advantages of slot-based deployments.
Go deeper
Related to this question
About these practice questions
This AZ-204 question is part of Courseiva's 881-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This AZ-204 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AZ-204 exam.