Question

Difficulty: EasyAzure Key Vault Secret, Key, and Certificate Management

You are deploying a web application to Azure App Service. You want to retrieve a database connection password stored in Azure Key Vault directly through the App Service application settings without modifying the application code.

Which of the following is the correct syntax to use as the value for the application setting to reference a secret named 'db-password' in a Key Vault named 'myvault'?

  1. A
    @AzureKeyVault(SecretUri=https://myvault.vault.azure.net/secrets/db-password/)
  2. B
    https://myvault.vault.azure.net/secrets/db-password/
  3. @Microsoft.KeyVault(SecretUri=https://myvault.vault.azure.net/secrets/db-password/)Answer
  4. D
    @Microsoft.KeyVault(VaultUri=https://myvault.vault.azure.net;SecretName=db-password)

Answer

The correct syntax is @Microsoft.KeyVault(SecretUri=https://myvault.vault.azure.net/secrets/db-password/)
The correct format for a Key Vault reference in App Service uses the prefix @Microsoft.KeyVault followed by the SecretUri parameter set to the secret's absolute URL. This allows App Service to retrieve the secret automatically at runtime using the application's managed identity.

Step-by-Step Solution

1
Identify the required prefix for Azure Key Vault references in App Service.
The prefix must be @Microsoft.KeyVault.
Azure App Service uses the @Microsoft.KeyVault keyword to detect and process settings that should be fetched from Key Vault.
2
Determine the parameter format required to specify the location of the secret.
The parameters inside the parentheses must be either SecretUri or a combination of VaultName and SecretName.
The reference resolver requires specific key names to identify the vault and secret.
3
Format the final configuration value.
@Microsoft.KeyVault(SecretUri=https://myvault.vault.azure.net/secrets/db-password/)
This format correctly combines the prefix and the valid SecretUri parameter.

Key Concept

Azure Key Vault references in App Service application settings allow applications to securely access secrets without modifying application code.
Estimated Time:45s
Rate this question