Question

Difficulty: EasySecure App Configuration and Key Vault References

You are deploying a web application to Azure App Service. The application must retrieve a database connection string stored in Azure Key Vault named keyvault1. You need to configure an application setting named ConnectionString using a Key Vault reference that points to a secret named dbsecret. Which of the following represents the correct format to use as the value of the application setting?

  1. @Microsoft.KeyVault(SecretUri=https://keyvault1.vault.azure.net/secrets/dbsecret/)Answer
  2. B
    @Azure.KeyVault(SecretUri=https://keyvault1.vault.azure.net/secrets/dbsecret/)
  3. C
    @Microsoft.KeyVault(Uri=https://keyvault1.vault.azure.net/secrets/dbsecret/)
  4. D
    @Microsoft.KeyVault(Vault=keyvault1;Secret=dbsecret)

Answer

The correct format is '@Microsoft.KeyVault(SecretUri=https://keyvault1.vault.azure.net/secrets/dbsecret/)'
The correct syntax uses the prefix '@Microsoft.KeyVault' and the parameter 'SecretUri' to specify the full URI of the secret in Azure Key Vault.

Step-by-Step Solution

1
Identify the required prefix for Key Vault references in Azure App Service settings.
The prefix must be '@Microsoft.KeyVault'.
Azure App Service requires this specific prefix to detect and parse the value as a Key Vault reference.
2
Determine the correct parameter name when reference is defined by a secret URI.
The parameter name is 'SecretUri'.
The parser expects 'SecretUri' followed by the URL of the Key Vault secret.
3
Combine the prefix and parameter into the final reference string.
'@Microsoft.KeyVault(SecretUri=https://keyvault1.vault.azure.net/secrets/dbsecret/)'
This matches the official syntax format for referencing a secret by URI.

Key Concept

Key Vault Reference Syntax in Azure App Service
Estimated Time:45s
Rate this question