azureblog.co.uk
← SC-300 study plan
SC-300 · Plan and implement workload identities

Identities for applications and Azure workloads

Choosing between managed identities, service principals, user accounts and managed service accounts, then creating, assigning and using managed identities.

  • 14 min
  • 4 concepts
  • Try it yourself
  • 4-question check

Learn

Apps and scripts need to sign in too. The aim is to give each one its own identity with only the access it needs, and ideally no secret that someone has to store or rotate.

  1. 1

    Select appropriate identities for applications and Azure workloads, including managed identities, service principals, user accounts, and managed service accounts

    Managed identity: for code running on Azure resources that support it; no credentials to manage. Service principal (from an app registration): for apps outside Azure or multi-tenant apps; uses a certificate (preferred), secret or workload identity federation (trust a GitHub Actions or Kubernetes token, no secret). User accounts shouldn't be used as service accounts. Group managed service accounts (gMSA) are for on-premises Windows services.

    Remember: Running in Azure? Managed identity. Outside Azure? Service principal, ideally with federation.

  2. 2

    Create managed identities

    System-assigned: switched on for one resource, created and deleted with it. User-assigned: a standalone Azure resource (Microsoft.ManagedIdentity/userAssignedIdentities) that can be attached to several resources and survives them. Create user-assigned identities in the portal, CLI (az identity create), PowerShell or templates.

    Remember: Shared across resources or pre-provisioned access? User-assigned.

  3. 3

    Assign a managed identity to an Azure resource

    Turn on system-assigned identity on the resource's Identity page, or add a user-assigned identity there. Supported resources include VMs, scale sets, App Service, Functions, Logic Apps, Container Apps, AKS and many more. You need the Managed Identity Operator role to assign a user-assigned identity.

    Remember: Identity page → System assigned: On.

  4. 4

    Use a managed identity assigned to an Azure resource to access other Azure resources

    Grant the identity a role on the target, for example Key Vault Secrets User on a vault or Storage Blob Data Reader on a storage account. In code, use the Azure Identity library's DefaultAzureCredential or ManagedIdentityCredential; it gets tokens from the local identity endpoint. For a user-assigned identity, specify its client ID.

    Remember: No role assignment, no access, even with an identity.

System-assigned or user-assigned?

System-assigned
  • Tied to one resource
  • Deleted with the resource
  • Simple for single workloads
User-assigned
  • Separate Azure resource
  • Shared by many resources
  • Grant access before the resource exists

Try it

Pick the right identity for the workload.

This interactive part needs JavaScript.

In the portal

  • Turn on a managed identityAzure portal: your resource > Settings > Identity
  • Create a user-assigned identityAzure portal: Managed Identities > Create
  • Federated credentialsEntra admin center: Entra ID > App registrations > your app > Certificates & secrets > Federated credentials

Key terms

Click a card to see the definition.

Check your understanding

4 questions. Score 80% or more and these skills are marked as confident in your SC-300 study plan.

  1. Which identity is deleted when its VM is deleted?

  2. A GitHub Actions workflow deploys to Azure. How do you avoid storing a secret?

  3. A web app's managed identity can't read Key Vault secrets. What's missing?

  4. Which is a standalone Azure resource?

Sources

Facts in this lesson are from Microsoft Learn. This site isn't affiliated with Microsoft.