An administrator is configuring a deployment slot named staging for an Azure App Service web app named app-finance that runs on a Standard S1 App Service plan. The web app connects to an Azure SQL database. The production slot must connect to a database named db-prod by retrieving a connection string from an Azure Key Vault named kv-prod. The staging slot must connect to a database named db-stage by retrieving a connection string from an Azure Key Vault named kv-stage. A system-assigned managed identity is enabled on both the production slot and the staging slot. The database connection string is configured in the App Service settings under the name DbConnectionString using Key Vault references. The administrator needs to configure the web app and Key Vaults to ensure that after a slot swap, the web app running in the production slot connects to db-prod and the web app running in the staging slot connects to db-stage, without any authentication failures. Which of the following configurations should the administrator implement?
- AConfigure DbConnectionString as a deployment slot setting in both slots. Grant the Key Vault Contributor role on the resource group containing the Key Vaults to both managed identities.
- Configure DbConnectionString as a deployment slot setting in both slots. Grant the Key Vault Secrets User role in kv-prod to the production slot's managed identity, and grant the Key Vault Secrets User role in kv-stage to the staging slot's managed identity.Answer
- CConfigure DbConnectionString as a deployment slot setting in both slots. Assign the Microsoft Entra ID Application Administrator role to the managed identities of both slots to allow them to read secrets from the Key Vaults.
- DConfigure DbConnectionString as a standard (non-slot) setting in both slots, and scale down the App Service plan to the Basic B1 tier to reduce costs during testing.