You are deploying a C# ASP.NET Core web application to Azure App Service. The application is configured to use a system-assigned managed identity. The application must retrieve a database password from an Azure Key Vault named kv-finance-prod. The Key Vault is configured with the Vault access policy permission model.
The application contains the following C# code to retrieve the secret:
csharp
using System;
using Azure.Identity;
using Azure.Security.KeyVault.Secrets;
// ...
var client = new SecretClient(new Uri("https://kv-finance-prod.vault.azure.net/"), new DefaultAzureCredential());
KeyVaultSecret secret = await client.GetSecretAsync("DbPassword");
During testing, the call to GetSecretAsync fails with a RequestFailedException showing a 403 (Forbidden) error.
Which action should you perform to resolve the authorization issue using the minimum level of privileges?
- AAssign the Key Vault Secrets User Azure RBAC role to the application's system-assigned managed identity at the Key Vault scope.
- BAdd a Key Vault access policy for the application's system-assigned managed identity and grant it the Get and List secret permissions.
- Add a Key Vault access policy for the application's system-assigned managed identity and grant it the Get secret permission.Answer
- DConfigure a user-assigned managed identity for the App Service and assign it the Reader Azure RBAC role at the resource group scope.