An organization is deploying an Azure Function App (V4 runtime) that requires access to a database password. To secure the credential, the password is stored in an Azure Key Vault. A developer configures an App Setting in the Function App named DatabaseConnectionString with the value @Microsoft.KeyVault(SecretUri=https://myvault.vault.azure.net/secrets/dbpassword/). When the function executes, it is unable to connect to the database because the environment variable retrieves the raw @Microsoft.KeyVault(...) reference string instead of the resolved secret value. Which of the following is the most likely cause of this behavior?
- AThe Key Vault reference syntax is invalid because the secret version must be explicitly appended to the end of the secret URI.
- The system-assigned managed identity of the Function App has not been granted GET permissions on secrets in the Key Vault access policies or Azure role-based access control.Cevap
- CThe Function App is running on the serverless Consumption hosting tier, which does not support Key Vault reference resolution.
- DKey Vault references only support user-assigned managed identities, but the Function App has been configured with a system-assigned managed identity.
Cevap
The system-assigned managed identity of the Function App has not been granted GET permissions on secrets in the Key Vault access policies or Azure role-based access control.
The App Service and Azure Functions runtime resolves Key Vault references at startup or configuration reload using the app's managed identity. If the system-assigned managed identity of the Function App does not have GET permission on secrets in the Key Vault, the platform fails to retrieve the secret and defaults to exposing the raw configuration string to the application code.
Adım Adım Çözüm
Anahtar Kavram
Key Vault references in Azure Functions allow app settings to securely reference secrets stored in Key Vault, requiring appropriate managed identity configurations and access policies.
Tahmini Süre:1m 30s