# Least privilege for workload identities in Azure means managed identities and federated credentials with narrow role assignments

Facts read 16 Nov 2026. Page reviewed 16 Nov 2026.

Workload identities in Azure are managed identities and federated service principals used by software on Azure compute, Kubernetes and CI/CD. Microsoft's documentation, read 16 Nov 2026, explains system-assigned and user-assigned identities and workload identity federation. This guide covers cutting their roles and measuring use.

## Managed identities and federated credentials replace stored secrets for workloads

Microsoft's documentation says managed identities remove the need for developers to manage credentials, because the credentials are not accessible to them. A managed identity can be assigned to Azure compute such as virtual machines, virtual machine scale sets, Service Fabric clusters, AKS and supported app hosting platforms. Microsoft states managed identities can be used at no extra cost.

There are two kinds. A system-assigned identity is created with the resource and deleted with it, and only that resource can request tokens with it. A user-assigned identity is a standalone resource that can be assigned to several resources, and Microsoft calls it the recommended type for Microsoft services.

Workload identity federation lets a user-assigned managed identity or app registration trust tokens from an external identity provider. Microsoft lists GitHub Actions, any Kubernetes cluster (AKS, EKS, GKE or on-premises), Google Cloud, AWS, SPIFFE and Azure Pipelines service connections as supported scenarios. The federated identity credential states which token from the provider is trusted.

Both mechanisms remove the secret. Neither limits what the identity can do. That is set by its Azure role assignments.

## Microsoft's best practice page shows where convenience works against least privilege

Microsoft's managed identity recommendations say user-assigned identities suit more scenarios and reduce administration. In its example, four virtual machines sharing one user-assigned identity need two role assignments, against eight with system-assigned identities.

The cost is that permissions are shared. Microsoft states that when an identity needs more role assignments they are granted to all the resources associated with it. If each resource needs a unique set of permissions, Microsoft says to use a system-assigned identity, and it also recommends system-assigned identities when you need the permissions removed along with the resource or need logs that show which resource acted.

Microsoft's best practices also allow a resource to have both a system-assigned and one or more user-assigned identities, so shared access and granular access can be separated.

Defender for Cloud covers managed identities in its permission analysis, with recommendations for overprovisioned identities based on actual usage, as Microsoft documents. The Azure RBAC rules from the [human identities guide](/guides/azure-human-identities/) apply: narrow scope, no wildcards.

## Steps to bring workload identities to least privilege

- List managed identities and the resources that use them. For each user-assigned identity, record every attached resource.
- Split any shared user-assigned identity whose attached resources need different access, or move those resources to system-assigned identities.
- Replace app registrations that hold secrets with managed identities for workloads running on Azure.
- For GitHub Actions, Kubernetes and other external workloads, create federated identity credentials in place of secrets and restrict each credential to the issuer and subject it should trust.
- Replace Owner and Contributor assignments with data-plane or job-specific roles at resource scope.
- Remove role assignments for deleted resources and for identities that no resource uses.
- Review Defender for Cloud right-sizing recommendations for managed identities and apply them in a non-production subscription first.
- Set a review cadence. See [what least privilege access covers](/least-privilege-access/) for the ordering.

## Roles and patterns to avoid on workload identities

| Role or pattern | Documented reason (Microsoft, read 16 Nov 2026) | Use instead |
| --- | --- | --- |
| Owner or Contributor on a managed identity | Microsoft describes Owner as including role assignment and Contributor as full resource management. | A role scoped to the single downstream service. |
| One user-assigned identity shared by unlike workloads | Microsoft says added role assignments are granted to every resource using the identity. | Identities per permission set. |
| Client secrets for workloads that can federate | Microsoft says federation removes secrets for GitHub, Kubernetes and other external providers. | Federated identity credentials. |
| Broad federated trust (any subject) | Microsoft says the federated credential defines which token from the provider is trusted. | A credential limited to the exact issuer and subject. |
| Wildcard custom roles | Microsoft says wildcards can add future permissions unintentionally. | Explicit Actions and DataActions. |

## Measure assignments per identity and use per assignment

Record the count of role assignments per managed identity and the count of resources attached to each user-assigned identity. A rising attached-resource count with a flat role list means the identity's permissions are shared more widely than when it was designed.

Compare granted roles with use through the Defender for Cloud right-sizing recommendations and the Azure Activity Log. Count external credentials by type: secret, certificate, federated. The trend toward federated is the simplest sign of progress. [Privilege creep](/privilege-creep/) describes why the role list rarely shrinks without this measurement.

Related guides: [AWS workload identities](/guides/aws-workload-identities/) and [Google Cloud workload identities](/guides/google-cloud-workload-identities/).

## Related pages

- [Least privilege for third-party identities in Azure](/guides/azure-third-party-identities/)
- [Least privilege for human users in Google Cloud](/guides/google-cloud-human-identities/)
- [Least privilege for service identities in Google Cloud](/guides/google-cloud-service-identities/)
- [All of them](/guides/)

## Sources

- Microsoft Learn: What are managed identities for Azure resources: https://learn.microsoft.com/en-us/entra/identity/managed-identities-azure-resources/overview (read 16 Nov 2026)
- Microsoft Learn: Managed identity best practice recommendations: https://learn.microsoft.com/en-us/entra/identity/managed-identities-azure-resources/managed-identity-best-practice-recommendations (read 16 Nov 2026)
- Microsoft Learn: Workload identity federation: https://learn.microsoft.com/en-us/entra/workload-id/workload-identity-federation (read 16 Nov 2026)
- Microsoft Learn: Workload identities: https://learn.microsoft.com/en-us/entra/workload-id/workload-identities-overview (read 16 Nov 2026)
- Microsoft Learn: Permissions management (CIEM) in Defender for Cloud: https://learn.microsoft.com/en-us/azure/defender-for-cloud/permissions-management (read 16 Nov 2026)
- Microsoft Learn: Best practices for Azure RBAC: https://learn.microsoft.com/en-us/azure/role-based-access-control/best-practices (read 16 Nov 2026)

Last reviewed 16 Nov 2026. Canonical: https://leastprivilegeprinciple.com/guides/azure-workload-identities/
