Azure App Service Web Apps · AZ-204: Developing Solutions for Microsoft Azure Develop Azure Compute Solutions

An ASP.NET Core web app hosted in Azure App Service must access a database password without storing the password in source code or in a deployment pa…

Practice question from Azure App Service Web Apps (AZ-204: Developing Solutions for Microsoft Azure Develop Azure Compute Solutions), with the correct answer and a step-by-step solution.

hard · MCQ · Q-D70B95

An ASP.NET Core web app hosted in Azure App Service must access a database password without storing the password in source code or in a deployment package. The password is stored as a secret in Azure Key Vault. The web app uses a system-assigned managed identity. Which configuration should you use?

  1. A.Add the plaintext password as an App Service application setting and disable managed identity.
  2. B.Add an application setting with a value such as @Microsoft.KeyVault(SecretUri=https://myvault.vault.azure.net/secrets/DbPassword/) and grant the web app identity permission to read Key Vault secrets.Correct answer
  3. C.Add the Key Vault administrator username and password as application settings, then have the application call Key Vault.
  4. D.Place the secret in the web app's wwwroot directory and restrict access using an App Service access restriction.

Solution

App Service Key Vault references let an application setting resolve to a Key Vault secret without putting the secret value in source code or the deployment package. The web app's managed identity must be granted permission, such as the Key Vault Secrets User role when Azure RBAC is used.

More from Azure App Service Web Apps

All of Azure App Service Web Apps

Practise more Develop Azure Compute Solutions

Sign up free for adaptive practice on this chapter, with instant feedback and hints on every question.

Start practising free

Free to start · No credit card needed