You are configuring a Python FastAPI web application hosted on Azure App Service to load its settings from an Azure App Configuration store. One of the keys in the App Configuration store, DbConnectionString, is configured as a Key Vault reference pointing to a secret in Azure Key Vault. The App Service is configured to use a system-assigned managed identity. At runtime, the application successfully retrieves standard key-values from the App Configuration store but fails with an authorization error when attempting to resolve the value of the DbConnectionString key. How should you resolve this issue?
- Grant the App Service's system-assigned managed identity the Key Vault Secrets User role on the Azure Key Vault.Cevap
- BGrant the Azure App Configuration instance's managed identity the Key Vault Secrets User role on the Azure Key Vault.
- CUpdate the value of the DbConnectionString key in Azure App Configuration to use the @Microsoft.KeyVault(SecretUri=...) format.
- DConfigure the App Service to use a user-assigned managed identity instead of a system-assigned managed identity.
Cevap
Grant the App Service's system-assigned managed identity the Key Vault Secrets User role on the Azure Key Vault.
The correct solution is to grant the App Service's system-assigned managed identity the Key Vault Secrets User role on the Azure Key Vault. In Azure App Configuration, Key Vault references are resolved client-side by the application client library. This library uses the credentials supplied to the configuration provider (in this scenario, the system-assigned managed identity of the App Service) to authenticate directly against the Azure Key Vault. Therefore, the App Service's identity requires direct access to read secrets in the Key Vault.
Adım Adım Çözüm
Anahtar Kavram
Key Vault Reference Resolution in Azure App Configuration
Tahmini Süre:1m 30s