Question

Difficulty: MediumConfigure Azure App Service Web Apps

To secure database credentials, a company's web application running on an Azure App Service web app must load its connection string from a central Azure Key Vault. The developers plan to configure Key Vault references within the app settings.

Which two configuration steps are required to ensure the web app can successfully resolve the references at runtime? (Choose two.)

  1. Enable a system-assigned managed identity on the web app and grant it Get secrets permission in the Key Vault access policies.Answer
  2. Set the App Setting value to @Microsoft.KeyVault(SecretUri=https://vault-prod.vault.azure.net/secrets/db-conn/).Answer
  3. C
    Enable a system-assigned managed identity on the Key Vault and grant the web app permission to access it.
  4. D
    Set the App Setting value to @KeyVault(SecretUri=https://vault-prod.vault.azure.net/secrets/db-conn/).

Answer

To resolve Key Vault references, you must enable a system-assigned managed identity on the web app and grant it Get secrets permission in the Key Vault, and set the App Setting value to use the correct syntax starting with the @Microsoft.KeyVault prefix.
For an App Service web app to resolve Key Vault secrets at runtime, two conditions must be met: the app must have an identity authorized to access the Key Vault, and the app setting must use the valid syntax. Enabling a system-assigned managed identity on the web app and granting it Get secrets permission in Key Vault satisfies the security requirement. Setting the App Setting value to the exact @Microsoft.KeyVault(SecretUri=...) format satisfies the syntactic requirement.

Step-by-Step Solution

1
Enable Managed Identity on App Service
The web app gets an identity registered in Microsoft Entra ID.
App Service requires an identity to authenticate to Key Vault without storing credentials in code.
2
Grant Access Policy in Key Vault
The web app's identity is authorized to retrieve secrets.
Without Get permission, the reference resolution will fail with a forbidden status.
3
Configure App Setting with correct syntax
The runtime detects the @Microsoft.KeyVault prefix and fetches the secret value.
Valid formatting is required for the App Service integration to intercept the setting request.

Key Concept

Key Vault references in App Service allow an application to use Key Vault secrets in app settings without code changes, requiring a managed identity, proper access permissions, and correct URI syntax.
Rate this question