When using managed identities in Azure, it is important to choose the right type. Use system-assigned identities for simple, single-resource scenarios, and user-assigned identities when the identity needs to be shared, reused, or managed separately.
Figure: Select the managed identity type in the Azure portal
A system-assigned managed identity belongs to a single Azure resource. It has a 1:1 relationship with that resource — one resource, one identity.
Example:
You have a App Service A, and it needs to read a database connection string stored in Key Vault A.
In this setup, the identity belongs only to App Service A. If App Service A is deleted, the identity is also removed.
Use this for the simplest case: one app, one identity, one target resource.
A user-assigned managed identity is a separate Azure resource that can be attached to multiple Azure resources. It supports a many-to-many relationship — one identity can be used by many resources, and one resource can also have multiple user-assigned identities.
Example:
You have 2 applications, App Service A and App Service B, and both need to read the same set of secrets from Key Vault A.
In this setup, both apps share the same identity and the same permissions. If one app is deleted, the identity can still be reused by the other app or attached to a new resource later.
Use this when multiple apps need the same identity and the same permissions.
Common use cases