Demystifying system-assigned managed identity and user-assigned managed identity for Azure Resources

Radu Vunvulea
3 min readFeb 21, 2020

--

Source: http://vunvulearadu.blogspot.com/2020/02/demystifying-system-assigned-managed.html

Managing credentials and access rights across services it is always a challenge inside the cloud. Storing them inside the applications can be painful, even when they are encrypted. Managing all of them from one central location can be done quickly using managed to identify feature build on top of Azure AD.

Because it is so easy to see and the number of features is high, many people forget to understand better what option they should use depending on the use case. Let’s take a look at some questions that you should ask yourself when you need to manage the identity of cloud services inside Azure.

Q: What is the username password when I’m using user-assigned manage identity

R: When you create a user-assigned managed identity, there is no used as you have for Azure AD. Even if the name contains the word ‘user’, it does not mean that you manage a user. You have an identity that can be operated independently of the service instance that receives the identity.

Q: I want to be able to assign the same identity to multiple resources — configure one time and use in multiple places. What shall I use?

R: In this case, you need to use a user-assigned managed identity. Once the identity is created, you can assign it to multiple services. Remember that system-assigned managed identity is created and assigned from the beginning to a single instance. It is deleted automatically at the moment in time when the instances are deleted. For example, a system-assigned identity that provides access for an Azure Web App to Azure Key Vault will exist as long as the instance of the Azure Web App exist. At the moment in time when the Azure Web App is deleted, the identity it is also removed with all other information that exists in the Azure Key Vault access management and Azure AD.

Q: What is the lifecycle of the user-assigned managed identity?

R: The lifecycle is fully managed by you. You are the one that decide when the identity is deleted and can exist even when there are no Azure services instances assigned to it.

Q: What is the no. of Azure services that I can assign to user-assigned managed identity?

R: 0 to N. There is no limitation from this point of view. In comparison, system-assigned managed identity can be assigned to only one Azure service instance and cannot be defined without being attached to an instance. This is why user-assigned managed identities are seen as a stand-alone Azure resource, in comparison with the other ones that are part of the Azure service instance.

Q: When I shall use system-assigned managed identity?

R: This kind of identity is used with success when the identity is required by only one service. For example, you have only one Azure App Service or Azure Function that needs specific access rights. When you need to assign the identity for multiple services, user-assigned managed identity is the answer.

Q: What are managed identities?

R: Behind the scene, managed identities are service principals of a special type. They can be used only for Azure resources, and their life-cycle is around them.

Q: How does the system-assigned managed identity works?

R: When you assigned a managed identity, the Azure Resource Manager (ARM) would go to IMDS and assign the managed identity to the specific resource. Once the identity is attached to the resource, the Azure AD will ‘connect’ a role to the resource service principal. From that one, the resource can request an access token from IMDS endpoint that is used to access specific resources. The user-assigned managed identity is similar, with some small expectation because the life-cycle of the managed identity is outside the resource boundary.

--

--

Radu Vunvulea
Radu Vunvulea

Written by Radu Vunvulea

Technology enthusiast that runs away from stupidity and enjoy the simple life of the cloud era. Speaker, traveler and crafter, he is a wine and coffee lover

Responses (1)