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(...

How to audit an Azure Cosmos DB

In this post, we will talk about how we can audit an Azure Cosmos DB database. Before jumping into the problem let us define the business requirement: As an Administrator I want to be able to audit all changes that were done to specific collection inside my Azure Cosmos DB. The requirement is simple, but can be a little tricky to implement fully. First of all when you are using Azure Cosmos DB or any other storage solution there are 99% odds that you’ll have more than one system that writes data to it. This means that you have or not have control on the systems that are doing any create/update/delete operations. Solution 1: Diagnostic Logs Cosmos DB allows us activate diagnostics logs and stream the output a storage account for achieving to other systems like Event Hub or Log Analytics. This would allow us to have information related to who, when, what, response code and how the access operation to our Cosmos DB was done. Beside this there is a field that specifies what was th...

Cloud Myths: Cloud is Cheaper (Pill 1 of 5 / Cloud Pills)

Cloud Myths: Cloud is Cheaper (Pill 1 of 5 / Cloud Pills) The idea that moving to the cloud reduces the costs is a common misconception. The cloud infrastructure provides flexibility, scalability, and better CAPEX, but it does not guarantee lower costs without proper optimisation and management of the cloud services and infrastructure. Idle and unused resources, overprovisioning, oversize databases, and unnecessary data transfer can increase running costs. The regional pricing mode, multi-cloud complexity, and cost variety add extra complexity to the cost function. Cloud adoption without a cost governance strategy can result in unexpected expenses. Improper usage, combined with a pay-as-you-go model, can result in a nightmare for business stakeholders who cannot track and manage the monthly costs. Cloud-native services such as AI services, managed databases, and analytics platforms are powerful, provide out-of-the-shelve capabilities, and increase business agility and innovation. H...