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'?
- A@AzureKeyVault(SecretUri=https://myvault.vault.azure.net/secrets/db-password/)
- Bhttps://myvault.vault.azure.net/secrets/db-password/
- @Microsoft.KeyVault(SecretUri=https://myvault.vault.azure.net/secrets/db-password/)Answer
- 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
Key Concept
Azure Key Vault references in App Service application settings allow applications to securely access secrets without modifying application code.
Estimated Time:45s