Your company deploys an Azure App Service web app named webapp-prod. The web app must retrieve a database connection string securely from an Azure Key Vault named kv-prod. You configure a user-assigned managed identity named id-webapp for webapp-prod and grant it the Key Vault Secrets User role on kv-prod. You need to configure the App Service application settings so that the web app can retrieve the latest version of the secret named DbConnectionString using the user-assigned identity. Which of the following configurations should you apply to the App Service application settings?
- AConfigure the DbConnectionString setting with the value @Microsoft.KeyVault(SecretUri=https://kv-prod.vault.azure.net/secrets/DbConnectionString;Identity=id-webapp).
- BConfigure the DbConnectionString setting with the value @Microsoft.KeyVault(SecretUri=https://kv-prod.vault.azure.net/secrets/DbConnectionString) and add an application setting named managedIdentityClientId set to the client ID of the user-assigned managed identity.
- Configure the DbConnectionString setting with the value @Microsoft.KeyVault(SecretUri=https://kv-prod.vault.azure.net/secrets/DbConnectionString) and add an application setting named keyVaultReferenceIdentity set to the resource ID of the user-assigned managed identity.Cevap
- DConfigure the DbConnectionString setting with the value @Microsoft.KeyVault(SecretUrl=https://kv-prod.vault.azure.net/secrets/DbConnectionString) and add an application setting named keyVaultReferenceIdentity set to the resource ID of the user-assigned managed identity.
Cevap
Configure the DbConnectionString setting with the value @Microsoft.KeyVault(SecretUri=https://kv-prod.vault.azure.net/secrets/DbConnectionString) and add an application setting named keyVaultReferenceIdentity set to the resource ID of the user-assigned managed identity.
The correct configuration uses the standard `@Microsoft.KeyVault(SecretUri=...)` syntax to point to the secret URI. Additionally, because the application uses a user-assigned managed identity, the `keyVaultReferenceIdentity` application setting must be added, with its value set to the resource ID of that user-assigned managed identity, to let App Service know which identity to use to authenticate to the Key Vault.
Adım Adım Çözüm
Anahtar Kavram
Key Vault references in Azure App Service allow applications to securely retrieve secrets without exposing them in configuration. When using user-assigned managed identities, you must configure the keyVaultReferenceIdentity setting alongside the reference.
Tahmini Süre:2m 0s