You are deploying a web application to an Azure App Service web app named app-inventory. The application must retrieve a database connection string from an Azure Key Vault named kv-prod.
You have the following requirements:
- Authenticate to the Key Vault using a user-assigned managed identity named id-inventory.
- Configure the application settings of the web app to retrieve the credential using a Key Vault reference.
- Ensure the configuration automatically retrieves the latest version of the secret.
Which two actions must you perform to configure the web app? (Choose two.)
- Grant the id-inventory user-assigned managed identity a Key Vault access policy with Secret Get permissions on kv-prod.Cevap
- Set the keyVaultReferenceIdentity configuration property of the web app to the resource ID of the id-inventory managed identity.Cevap
- CSet the value of the application setting to @KeyVault(SecretUri=https://kv-prod.vault.azure.net/secrets/DbConnectionString).
- DEnable a system-assigned managed identity on the web app and grant it permissions to kv-prod.
- EGrant the App Service plan hosting the web app a Key Vault access policy with Secret Get permissions on kv-prod.
Cevap
Grant the user-assigned managed identity the required Secret Get permissions on the Key Vault, and set the keyVaultReferenceIdentity configuration property of the web app to the resource ID of that user-assigned managed identity.
To retrieve Key Vault secrets using a user-assigned managed identity in Azure App Service Key Vault references, you must perform two main steps. First, the user-assigned managed identity must have permissions to read secrets from the Key Vault (accomplished by granting it Secret Get permissions or the Key Vault Secrets User role). Second, because App Service defaults to the system-assigned identity, you must configure the web app's keyVaultReferenceIdentity property to use the resource ID of the user-assigned managed identity.
Adım Adım Çözüm
Anahtar Kavram
Configuring Key Vault references in Azure App Service with user-assigned managed identities.