You are configuring an Azure App Service web application to retrieve a third-party payment provider API key stored as a secret in Azure Key Vault. The Key Vault, named kv-payment-prod, is configured to use the Azure role-based access control (Azure RBAC) permission model. The web application uses a system-assigned managed identity for authentication. You must reference the Key Vault secret directly within the App Service application settings under a setting named PaymentApiKey. You must follow the principle of least privilege. Which action should you perform to configure the application setting and permissions?
- Assign the Key Vault Secrets User role to the web application's system-assigned managed identity at the Key Vault scope, and set the value of the PaymentApiKey application setting to @Microsoft.KeyVault(SecretUri=https://kv-payment-prod.vault.azure.net/secrets/ApiKey/).Cevap
- BCreate a Key Vault access policy for the web application's system-assigned managed identity that grants Get secret permissions, and set the value of the PaymentApiKey application setting to @Microsoft.KeyVault(SecretUri=https://kv-payment-prod.vault.azure.net/secrets/ApiKey/).
- CAssign the Key Vault Secrets User role to the web application's system-assigned managed identity at the Key Vault scope, and set the value of the PaymentApiKey application setting to @KeyVault(SecretUri=https://kv-payment-prod.vault.azure.net/secrets/ApiKey/).
- DCreate a new user-assigned managed identity, assign the Key Vault Reader role to this identity at the Key Vault scope, and set the value of the PaymentApiKey application setting to @Microsoft.KeyVault(SecretUri=https://kv-payment-prod.vault.azure.net/secrets/ApiKey/).
Cevap
Assign the Key Vault Secrets User role to the web application's system-assigned managed identity at the Key Vault scope, and set the value of the PaymentApiKey application setting to @Microsoft.KeyVault(SecretUri=https://kv-payment-prod.vault.azure.net/secrets/ApiKey/).
To allow the App Service to retrieve a secret from an Azure Key Vault configured with the Azure RBAC permission model, the application's system-assigned managed identity must be granted the Key Vault Secrets User role, which provides read access to the secret values. The App Service configuration reference must use the correct prefix @Microsoft.KeyVault(SecretUri=...) pointing to the secret's URI.
Adım Adım Çözüm
Anahtar Kavram
Azure Key Vault references in App Service configuration combined with Azure RBAC authorization.