You are deploying a single Azure App Service web app that needs to retrieve database credentials securely. You want to enable a managed identity for the web app to access Azure Key Vault. The identity must share the lifecycle of the App Service resource, meaning that if the App Service is deleted, the identity is automatically cleaned up. Which identity type or configuration should you implement for the App Service?
- A system-assigned managed identityAnswer
- BA user-assigned managed identity
- CAn App Registration service principal with a client secret
- DA Key Vault access policy without an associated identity
Answer
A system-assigned managed identity
A system-assigned managed identity is enabled directly on an Azure resource (such as an App Service). Its lifecycle is bound directly to that resource; when the host resource is deleted, Azure automatically deletes the identity in Microsoft Entra ID. This avoids leaving orphaned identity resources behind and simplifies lifecycle management.
Step-by-Step Solution
Key Concept
Managed Identity Lifecycle Management