A developer is configuring an application setting in an Azure App Service web app to reference a secret stored in an Azure Key Vault named kv-prod. The secret is named db-conn-string. The web app has a system-assigned managed identity configured with appropriate permissions. Which syntax should the developer use as the value for the application setting to retrieve the latest version of the secret?
- @Microsoft.KeyVault(VaultName=kv-prod;SecretName=db-conn-string)Answer
- B@Microsoft.KeyVault(Vault=kv-prod;Secret=db-conn-string)
- C@KeyVault(VaultName=kv-prod;SecretName=db-conn-string)
- DVaultName=kv-prod;SecretName=db-conn-string
Answer
The correct syntax to reference the Key Vault secret is @Microsoft.KeyVault(VaultName=kv-prod;SecretName=db-conn-string)
The syntax @Microsoft.KeyVault(VaultName=kv-prod;SecretName=db-conn-string) is correct because it uses the fully qualified namespace and the correct property keys (VaultName and SecretName) to dynamically fetch the latest version of the secret from Key Vault.
Step-by-Step Solution
Key Concept
Key Vault References in App Service Application Settings