Skip to main content

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


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. 

Comments

Popular posts from this blog

Windows Docker Containers can make WIN32 API calls, use COM and ASP.NET WebForms

After the last post , I received two interesting questions related to Docker and Windows. People were interested if we do Win32 API calls from a Docker container and if there is support for COM. WIN32 Support To test calls to WIN32 API, let’s try to populate SYSTEM_INFO class. [StructLayout(LayoutKind.Sequential)] public struct SYSTEM_INFO { public uint dwOemId; public uint dwPageSize; public uint lpMinimumApplicationAddress; public uint lpMaximumApplicationAddress; public uint dwActiveProcessorMask; public uint dwNumberOfProcessors; public uint dwProcessorType; public uint dwAllocationGranularity; public uint dwProcessorLevel; public uint dwProcessorRevision; } ... [DllImport("kernel32")] static extern void GetSystemInfo(ref SYSTEM_INFO pSI); ... SYSTEM_INFO pSI = new SYSTEM_INFO(

ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded

Today blog post will be started with the following error when running DB tests on the CI machine: threw exception: System.InvalidOperationException: The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information. at System.Data.Entity.Infrastructure.DependencyResolution.ProviderServicesFactory.GetInstance(String providerTypeName, String providerInvariantName) This error happened only on the Continuous Integration machine. On the devs machines, everything has fine. The classic problem – on my machine it’s working. The CI has the following configuration: TeamCity .NET 4.51 EF 6.0.2 VS2013 It see

Navigating Cloud Strategy after Azure Central US Region Outage

 Looking back, July 19, 2024, was challenging for customers using Microsoft Azure or Windows machines. Two major outages affected customers using CrowdStrike Falcon or Microsoft Azure computation resources in the Central US. These two outages affected many people and put many businesses on pause for a few hours or even days. The overlap of these two issues was a nightmare for travellers. In addition to blue screens in the airport terminals, they could not get additional information from the airport website, airline personnel, or the support line because they were affected by the outage in the Central US region or the CrowdStrike outage.   But what happened in reality? A faulty CrowdStrike update affected Windows computers globally, from airports and healthcare to small businesses, affecting over 8.5m computers. Even if the Falson Sensor software defect was identified and a fix deployed shortly after, the recovery took longer. In parallel with CrowdStrike, Microsoft provided a too