Question

Difficulty: MediumAzure Key Vault Secret, Key, and Certificate Management

An organization is deploying an ASP.NET Core web application to an Azure App Service. The application must retrieve a database password from an Azure Key Vault named `kv-finance-prod`. The Key Vault's permission model is configured to use Azure role-based access control (Azure RBAC). The App Service has a system-assigned managed identity enabled.

During testing, the application's C# code throws a `RequestFailedException` with an HTTP `403 Forbidden` error when calling `SecretClient.GetSecretAsync`.

You need to resolve this authorization issue using the principle of least privilege.

Which of the following actions should you perform?

  1. A
    Create an access policy in `kv-finance-prod` that grants the Get secret permission to the App Service's system-assigned managed identity.
  2. B
    Assign the Key Vault Reader role to the App Service's system-assigned managed identity at the Key Vault scope.
  3. Assign the Key Vault Secrets User role to the App Service's system-assigned managed identity at the Key Vault scope.Answer
  4. D
    Create a user-assigned managed identity, assign it the Key Vault Secrets User role at the Key Vault scope, and configure the App Service to use the system-assigned managed identity.

Answer

Assign the Key Vault Secrets User role to the App Service's system-assigned managed identity at the Key Vault scope.
Assigning the Key Vault Secrets User role to the App Service's system-assigned managed identity at the Key Vault scope is the correct solution because it grants the identity the necessary data-plane permissions to read secret values, and it adheres to the principle of least privilege. Because the Key Vault is configured with the Azure RBAC permission model, Azure RBAC roles must be used instead of classic access policies.

Step-by-Step Solution

1
Identify the Key Vault permission model.
The Key Vault uses the Azure RBAC model, meaning vault access policies cannot be used to grant data-plane access.
Determines the correct authorization mechanism to configure.
2
Determine the required permission level.
The application needs to read secret values using `SecretClient.GetSecretAsync`.
Allows selecting a role that matches the required data action.
3
Select the least-privilege role and target identity.
Select the Key Vault Secrets User role and assign it to the App Service's system-assigned managed identity at the Key Vault scope.
Ensures the application has read-only access to secrets without administrative or metadata-only access.

Key Concept

Assigning appropriate Azure RBAC roles to managed identities for Key Vault secrets retrieval
Estimated Time:1m 30s
Rate this question