You are designing the security architecture for an enterprise Azure Function app that processes financial transactions. The app requires access to an Azure SQL Database and retrieves cryptographic keys from an Azure Key Vault. Due to strict CI/CD and compliance policies, the Function app is frequently torn down and recreated in different resource groups using automated Terraform scripts. You need to choose a managed identity configuration that ensures the application can authenticate to Azure SQL and Key Vault with the least administrative effort during deployment cycles, specifically avoiding the need to recreate database users or update Key Vault access policies after each deployment.
Which configuration should you implement?
- Configure a user-assigned managed identity as a standalone Azure resource, grant it the required roles on the Azure SQL Database and Key Vault, and assign this identity to the Function app during deployment.Answer
- BConfigure a system-assigned managed identity for the Function app, and grant it the required roles on the Azure SQL Database and Key Vault.
- CConfigure a single system-assigned managed identity on the Azure Key Vault, and share its credentials with the Function app across all deployment resource groups.
- DConfigure a user-assigned managed identity, assign it to the Function app, and rely on the default Azure RBAC Reader role at the subscription level to grant it access to the Key Vault secrets.
Answer
Configure a user-assigned managed identity as a standalone Azure resource, grant it the required roles on the Azure SQL Database and Key Vault, and assign this identity to the Function app during deployment.
A user-assigned managed identity exists as a standalone Azure resource with its own lifecycle. When the Azure Function app is deleted and recreated by Terraform, the user-assigned identity and its associated service principal object ID remain unchanged. Consequently, the permissions granted to the identity in the Azure SQL Database and Azure Key Vault persist across deployments, requiring only that the new Function app instance be associated with the existing identity.
Step-by-Step Solution
Key Concept
The lifecycle difference between System-Assigned and User-Assigned Managed Identities.
Estimated Time:2m 0s