Home › Studies › SC-300 › Workload Identities › Managed Identities & Workload Choice

Managed Identities

Workload identity types · system-assigned vs user-assigned · create · assign to a resource · access other resources · gMSA/sMSA, service principal, user account

By the tools4free.dev team · Last reviewed November 13, 2026

Practice questions for this topic →

Choosing an identity for a workload

In Microsoft Entra, workload identities are applications, service principals, and managed identities. A managed identity is a special type of service principal that eliminates the need for developers to manage credentials.

IdentityWhat the pages sayPick it when
Managed identityAzure manages the credentials. Best for communication among services that support Microsoft Entra authentication. Can be used at no extra cost.The workload runs on an Azure resource and the target supports Microsoft Entra authentication.
Service principal (application)Authenticates with a client certificate or a client secret. Certificates are recommended because they can't be embedded in code by accident.You can't use a managed identity (for example the code runs outside Azure). Grant only the permissions and scope the task needs.
Microsoft Entra user accountEvaluate moving from a user account to a managed identity or a service principal.Avoid it as a service identity.
gMSA (on-premises)Use whenever possible for on-premises services. One identity for a server farm or services behind a network load balancer; also fine for one server.On-premises Windows service, several servers or a load balancer.
sMSA (on-premises)Use if you can't use a gMSA. Runs on only one server; can serve several services on that server. Needs at least Windows Server 2008 R2.On-premises service tied to one server.
Computer or user account (on-premises)Only if you can't use an MSA. With a computer account you can't tell which service on the computer uses it.Last resort; keep service accounts out of privileged groups.

A managed identity has only a service principal object. It has no application object, so Microsoft Graph permissions for a managed identity are granted directly to the service principal.

System-assigned vs user-assigned

PropertySystem-assignedUser-assigned
CreationCreated as part of an Azure resource (for example a VM or App Service).Created as a stand-alone Azure resource.
Life cycleShared with the resource; deleted when the resource is deleted.Independent; must be explicitly deleted.
SharingCan be associated with a single Azure resource only.Can be associated with more than one Azure resource.
Use casesOne workload on one resource; independent identity per resource.Several resources share one identity; access needed before the resource is deployed; resources recycled often but permissions stay.

Create and assign

TaskRole the account needs
Create or delete a user-assigned identityManaged Identity Contributor
List or read a user-assigned identityManaged Identity Operator or Managed Identity Contributor
Enable a system-assigned identity on a VMVirtual Machine Contributor (write permission on the resource); no other Microsoft Entra directory role
Assign a user-assigned identity to a VMVirtual Machine Contributor and Managed Identity Operator (the Microsoft.ManagedIdentity/userAssignedIdentities/*/assign/action action)
Grant the identity access to a target resourceOwner or User Access Administrator on the target resource
  1. Portal, create a user-assigned identity: search Managed Identities, select Add, choose subscription, resource group, region and name.
  2. Portal, system-assigned on an existing VM: VM > Security > Identity > System assigned > Status On > Save.
  3. Portal, user-assigned on an existing VM: VM > Security > Identity > User assigned > +Add. The portal can't assign a user-assigned identity while the VM is being created.

Identity names: start with a letter or number; alphanumerics, hyphens and underscores; limited to 24 characters for assignment to a VM or scale set to work. Deleting a user-assigned identity doesn't remove it from the resource it was assigned to.

Use the identity to reach other resources

  1. Create the managed identity (system-assigned or user-assigned).
  2. For a user-assigned identity, assign it to the source resource.
  3. Authorize the identity on the target service (for example an Azure role assignment).
  4. Get a token with the Azure.Identity library or MSAL, or from the Azure Instance Metadata Service (IMDS) endpoint on the VM.

Limits and lifecycle

ItemValue
CredentialCertificate-based; expires after 90 days and is rolled after 45 days (an implementation detail that can change without notice)
Soft delete30 days; you can view the service principal but can't restore or purge it
Directory quota guardCreation is blocked if the new service principal would take directory usage to 98% or more of the tenant quota; existing identities keep working
Moving a subscription to another directoryNot recreated automatically: disable and re-enable system-assigned; delete, re-create and re-attach user-assigned; grant roles again
Moving a user-assigned identity to another resource groupNot supported

Use Azure Policy with effect deny on type Microsoft.ManagedIdentity/userAssignedIdentities to stop people creating user-assigned identities in a scope.

CLI and PowerShell

TaskAzure CLIPowerShell
Create a user-assigned managed identityaz identity create -g myResourceGroup -n myUserAssignedIdentityNew-AzUserAssignedIdentity -ResourceGroupName <RESOURCEGROUP> -Name <USER ASSIGNED IDENTITY NAME>
Enable system-assigned identity on an existing VMaz vm identity assign -g myResourceGroup -n myVmUpdate-AzVM -ResourceGroupName myResourceGroup -VM $vm -IdentityType SystemAssigned
Assign a user-assigned identity to a VMaz vm identity assign -g <RESOURCE GROUP> -n <VM NAME> --identities <USER ASSIGNED IDENTITY>Update-AzVM -ResourceGroupName <RESOURCE GROUP> -VM $vm -IdentityType UserAssigned -IdentityID $uid
Remove a user-assigned identity from a VMaz vm identity remove -g <RESOURCE GROUP> -n <VM NAME> --identities <USER ASSIGNED IDENTITY>-
List a tenant's managed identity permissions (app roles)-Get-MgServicePrincipalAppRoleAssignment -ServicePrincipalId <String>

Exam Tips

Tick each tip once you can answer it without looking.

“Azure VM must read a storage account, no secrets in code” → Managed identity, then an Azure role on the storage account.. Trap: A service principal with a secret works but you must store and rotate the secret.

“Four VMs need identical access, permissions set before the VMs exist” → One user-assigned managed identity.. Trap: System-assigned identities are created with the resource, so roles can't be assigned in advance.

“Permissions must disappear when the resource is deleted; audit must show which resource acted” → System-assigned managed identity.. Trap: A user-assigned identity must be deleted explicitly.

“Who can create or delete a user-assigned identity?” → Managed Identity Contributor.. Trap: Managed Identity Operator can list/read and assign, not create or delete.

“Assign a user-assigned identity to a VM” → Virtual Machine Contributor plus Managed Identity Operator.. Trap: Virtual Machine Contributor alone covers system-assigned only.

“Portal: user-assigned identity during VM creation” → Not supported; create the VM, then add it under Security > Identity > User assigned.. Trap: System-assigned can be enabled on the Management tab at creation.

“Grant a managed identity a role on a storage account” → Owner or User Access Administrator on the target resource.. Trap: Granting access on the target needs Owner or User Access Administrator there.

“Permissions added to a group the identity belongs to still fail for hours” → Token cache (about 24 hours); assign roles directly to a user-assigned identity.. Trap: You can't force a managed identity token refresh.

“VM has several user-assigned identities; IMDS call fails” → Pass client_id, object_id or msi_res_id.. Trap: IMDS defaults only to the system-assigned identity, or to a single user-assigned one.

“Grant Microsoft Graph permission to a managed identity” → Assign the app role to its service principal.. Trap: There is no application object to configure on a managed identity.

“On-premises service on a server farm or behind a load balancer” → gMSA.. Trap: An sMSA runs on one server only.

“Script uses an Azure user account to call Azure” → Move to a managed identity; else a service principal with least permissions.. Trap: A user account as service identity is what the guidance tells you to replace.

“Subscription moved to another directory” → Re-create identities and role assignments.. Trap: They are not recreated automatically.

“New managed identity creation is blocked in the tenant” → Directory object quota at 98%; delete objects or ask Support for more.. Trap: Soft-deleted objects count, and existing identities keep working.

Sources

Checked against Microsoft Learn on November 13, 2026.

← Workload Identities overviewEnterprise Apps, Consent & App Proxy →