Question

Difficulty: EasyConfigure Azure App Service Web Apps

You need to configure an Azure App Service web app to retrieve application settings securely from an Azure Key Vault secret using a system-assigned managed identity. Which sequence of steps should you perform to complete this configuration?

  1. 1Enable the system-assigned managed identity on the Azure App Service web app.
  2. 2Create an access policy or Azure RBAC role assignment in the Azure Key Vault that grants Secret Get permissions to the web app's managed identity.
  3. 3Add a new application setting in the App Service web app that uses the `@Microsoft.KeyVault` reference syntax pointing to the secret URI.

Answer

To configure the retrieval of settings using a system-assigned managed identity, first enable the identity on the App Service web app to register its principal. Next, create a Key Vault access policy or role assignment that grants the identity Secret Get permissions. Finally, configure the web app's application settings using the Key Vault reference syntax.
The system-assigned managed identity must first be created on the App Service web app so its principal ID exists. Then, this principal must be granted Secret Get permissions in Key Vault. Finally, the application setting containing the Key Vault reference syntax is configured to successfully retrieve the secret.

Step-by-Step Solution

1
Enable the system-assigned managed identity on the web app.
The identity principal is created in Microsoft Entra ID.
This identity is required so that you have a security principal to which Key Vault permissions can be assigned.
2
Assign Secret Get permissions to the identity in Key Vault.
The identity is authorized to retrieve the secrets.
Without this authorization, the Key Vault service will reject any access attempts made by the App Service.
3
Add an application setting in the web app referencing the Key Vault secret.
The App Service retrieves the secret and exposes it as an environment variable.
Using the `@Microsoft.KeyVault` syntax in the app settings directs the App Service runtime to fetch the secret securely.

Key Concept

Integrating App Service Web Apps with Azure Key Vault using system-assigned managed identities.
Rate this question