Azure Managed Identity vs Service Principal: Differences and When to Use Each

Updated on December 3, 202625.4

Azure managed identities are Microsoft Entra service principals whose underlying credentials are managed by Azure. A conventional application service principal represents an app in a tenant and can authenticate with a certificate, a client secret or workload identity federation. The choice is not simply between an identity with a password and one without: both an application registration and a user-assigned managed identity can support federated, secretless authentication in appropriate scenarios.

For a supported Azure-hosted workload, start with a managed identity. Choose a system-assigned identity when the identity should disappear with the resource, or a user-assigned identity when permissions must survive resource replacement or be shared by workloads with the same trust boundary. For an external CI/CD pipeline, consider federation before creating a stored credential. A multitenant SaaS application normally needs an application registration and a service principal in each consenting tenant.

This guide explains how to make that decision, grant the right permissions and prove that a migration has actually removed the original credentials. It reflects documentation available on December 3, 2026. All worked examples are illustrative, not results from a live deployment.

Azure managed identity vs service principal at a glance

Factor System-assigned managed identity (SAMI) User-assigned managed identity (UAMI) Application service principal
Directory representation Special service principal Special service principal App’s local representation in a tenant
App registration required No No Normally yes
Provisioning Enable on supported resource Create separate Azure resource, attach as needed Register app and provision service principal
Lifecycle Bound to hosting resource Independent of attached resources Independent of compute
Credential ownership Azure Azure for direct authentication; team owns federation configuration if used Team owns secret, certificate or federation configuration
Direct token acquisition Supported Azure host Supported Azure host Any compatible environment with valid credential
External OIDC federation Not directly supported as federated credential target Supported Supported
Multiple hosts One Azure resource Supported, where appropriate Supported
Multitenant application consent Not designed for this Not designed for this Supported for multitenant registration
Authorization Azure RBAC or target-specific permissions Same Same
Deletion of host Identity deleted Identity remains Identity remains
Typical choice Single Azure-hosted resource Recreated infrastructure or dedicated workload group SaaS, external automation or app-specific requirements

A managed identity is not automatically more privileged or less privileged than an application service principal. Both can receive the same Azure role, and both can be overprivileged. Microsoft’s managed identity overview describes the two managed identity lifecycles; its application objects and service principals guide explains the directory representation.

Understanding the identity objects before choosing

A common source of deployment failures is treating an application registration, an enterprise application and an Azure identity resource as interchangeable. They represent different layers.

An application object is the definition of a registered application in its home directory. It describes the application’s identifiers, supported account types and other configuration. An application service principal is the corresponding local identity in a particular tenant. When an organization consents to a multitenant app, a local service principal can represent that app in its directory. The permission assignments made in that tenant determine what that instance can access.

A managed identity is different because its special service principal is provisioned and maintained through Azure, not by creating a normal application registration. You can find the directory representation in Enterprise applications, filtered to managed identities. Do not create a second app registration just because an Azure SDK asks for a client ID. The identity already has its own identifiers.

Two authentication paths: platform-managed Azure credentials and federated or conventional app credentials, converging on a resource access token
Original conceptual diagram: the credential path differs, but the target service still evaluates the resulting identity and its permissions.

Which identifier goes where?

Identifier What it identifies Typical use
Tenant ID Entra directory Authority and tenant selection
Application (client) ID Application identity SDK identity selection and OAuth client identification
Service principal object ID Tenant-local principal Azure role assignment, app-role assignment, directory audit
App registration object ID Application definition in home tenant Editing the application object through Graph
Managed identity resource ID Azure Resource Manager resource for UAMI Attaching the identity to compute or infrastructure deployment
Principal ID of managed identity Backing service principal object ID Granting a resource role

These IDs are generally not interchangeable. A deployment can succeed in creating an identity but fail to assign privileges if it passes the application object ID where the principal ID is required. Display names are even less reliable because they may not be unique. Record the tenant, principal and client IDs together with the Azure resource ID when applicable. See Microsoft’s managed identity glossary.

For more background on the directory, see our Microsoft Entra ID guide.

How authentication actually works

Imagine a reporting application that must read a secret from Key Vault and write a CSV file to Blob Storage. These are two separate target services with different token audiences and access controls. Obtaining a token for Azure Resource Manager does not allow the application to use that same token to read a vault secret.

Direct managed identity authentication

  1. Enable or attach a managed identity to supported compute.
  2. Grant the identity the necessary permissions on each downstream service.
  3. The application uses the platform’s managed identity authentication endpoint through a supported Azure SDK.
  4. The platform obtains an Entra access token for the intended target.
  5. The target validates the token and applies authorization and networking controls.

The token is still sensitive. Avoid logging it, and never return it to a browser or diagnostic endpoint. Managed identity removes the requirement to distribute a persistent Azure client credential; it does not make every process on the host trustworthy.

The host integration is service-specific. A VM uses the instance metadata service; App Service exposes a platform identity endpoint with its own authentication requirements. Prefer the SDK instead of implementing those protocols manually. This also allows the SDK to handle token caching and renewal.

Application service principal authentication

An application using the OAuth client credentials flow authenticates itself rather than signing in an employee. With a client secret, it proves possession of the secret to the token endpoint. With a certificate, the application signs an assertion using its private key. With federation, the application presents a trusted token from a separate identity provider. Microsoft Entra checks that proof and issues the appropriate access token.

The secret or certificate is not itself the access token. Credential expiration stops new token acquisition using that credential; already-issued tokens may remain usable subject to their lifetime and applicable controls. The difference matters when planning incident response or removing old credentials during migration.

Authentication is not authorization

A token proves an identity to an intended audience. It does not establish blanket access. For example, a storage account management role may let an identity inspect account configuration while not permitting direct Blob data reads. A role with key-listing permissions could also create an indirect access path, which should be assessed separately. For SQL Database, provision a suitable database principal and grant database permissions; merely assigning an Azure management role does not grant SELECT rights inside SQL.

For a vault using Azure RBAC, a Key Vault Secrets User assignment at a suitable scope permits secret retrieval but does not grant administrative access to all subscriptions. If the vault uses access policies, evaluate that different permission model. See our Azure Key Vault guide for networking and data-plane access considerations, and our Azure RBAC vs Azure Policy comparison for the relationship between permissions and governance rules.

System-assigned vs user-assigned managed identity

When system-assigned is preferable

Use SAMI for an application with an identity lifecycle that matches a single Azure resource. Suppose a Function app processes orders and needs only one storage container. It can have its own identity and its own role assignment. No other independently deployed application needs to share that identity. When the resource is permanently removed, the principal is removed too.

A redeployed or recreated resource can have a new principal ID. Infrastructure templates therefore need to create the appropriate new assignments and wait for availability before switching traffic. Deleting a principal does not necessarily remove every old Azure role assignment referencing it. Include those assignments in cleanup.

When user-assigned is preferable

A UAMI can exist before compute is created. This allows a deployment team to preconfigure access, then attach the identity during deployment. An application replaced through blue-green infrastructure or a short-lived VM fleet can continue using a stable identity if the same UAMI is attached and supported. Microsoft specifically discusses these patterns in its managed identity best practices.

The decision to share must be deliberate. An identity shared by ten unrelated applications gives each application a path to the identity’s effective permissions. Sharing a UAMI among replicas of one workload can be reasonable, while sharing one across unrelated business systems may destroy otherwise useful isolation. A resource’s ability to use multiple identities also depends on its service-specific capabilities.

Do not assume that the person attaching an identity needs direct permission to all downstream data. A user permitted to attach a powerful UAMI and execute code on the receiving host can effectively exercise the attached identity’s access. Limit both identity-assignment permissions and deployment/code-execution permissions. Separate Managed Identity Operator and identity administration from resource ownership according to the actual duties required.

Workload identity federation changes the comparison

An outdated rule says managed identities work inside Azure and service principals work outside Azure. This is a useful starting point for direct platform authentication, but it misses the modern federation model.

Microsoft’s workload identity federation documentation explicitly supports establishing external trust on either an app registration or a user-assigned managed identity. GitHub Actions, compatible Kubernetes clusters, Google Cloud and supported AWS outbound federation scenarios are examples. An external workload does not call the Azure VM identity endpoint; instead it obtains a token from its own trusted issuer and exchanges that token with Entra.

What must match?

The federated credential configuration describes the trusted issuer and subject (or supported alternative matching mechanism), and audience. A token from an unrelated repository, environment or Kubernetes service account should not match the configured trust. Restrict the upstream platform’s permissions to issue tokens, too: an overly broad repository workflow or editable deployment environment can undermine an otherwise narrow Azure role.

External CI pipeline obtains issuer token, Entra checks federation trust and issues an access token for the target
Original federation flow. An app registration or UAMI can be the trust target; role assignments are a separate control.
Requirement Federated app registration Federated UAMI
Create trust On application object On managed identity Azure resource
Administration boundary Entra app ownership and directory roles Azure resource permissions and identity management
Azure access Grant app’s local principal Grant managed identity principal
Credential held by CI Short-lived external assertion, then access token Same
Multitenant application Possible with appropriate registration and consent Not equivalent to multitenant app registration
Azure compute use Can exchange supported managed identity credential for app token Direct attachment to supported Azure host also possible

Federation is not an identity type. It is a way of authenticating an identity. That distinction explains why comparing only system-assigned identity, user-assigned identity and a secret-based service principal is incomplete.

Review federation constraints for the supported issuer, signing algorithm, credential limits and propagation behavior. If a newly configured trust fails with AADSTS70021, inspect the issuer, subject and audience first, then consider propagation delay. Do not weaken the trust to make an invalid token succeed.

Azure DevOps issuer retirement: July 1, 2027

For Azure Resource Manager workload identity service connections, Microsoft says the older Azure DevOps token issuer (https://vstoken.dev.azure.com) retires on July 1, 2027. New connections use the Microsoft Entra issuer by default. The change applies to eligible public-cloud connections using single-tenant applications or managed identities; non-public clouds and multitenant apps are outside that specific deprecation scope. Inspect flagged service connections and follow the supported conversion procedure rather than blindly replacing all service connections. See Microsoft’s current configuration and migration guidance.

Which identity should you choose? A workload decision matrix

Workload Starting choice Why Reconsider if
Single VM reading one vault SAMI Identity follows VM VM is recreated frequently and needs preauthorized access
App Service with blue-green replacements Dedicated UAMI Stable principal across supported replacements Workloads or deployment slots must be isolated
Ten identical worker replicas UAMI per trust boundary Shared purpose and access Replicas need different tenant or customer data
GitHub Actions deploying an Azure app Federated UAMI or app registration No persistent Azure secret in repository Issuer or tool cannot support federation
Azure DevOps hosted deployment agent Federated service connection Agent need not host the managed identity directly Task or target does not support connection type
AKS application pod Workload identity with dedicated UAMI/app Scope access to Kubernetes workload, not entire node Integration lacks supported identity flow
On-premises automation Federation if supported; certificate app otherwise Portable app authentication Platform has supported direct identity integration
Multitenant customer SaaS App registration with tenant-local principals Customer consent and isolation Single-tenant backend uses separate managed identities for its own dependencies
Third-party API accepting only API keys Managed identity to vault, API key to third party Reduces credential distribution Vendor supports Entra tokens or another federated flow
Local developer workstation Individual developer identity in development only Accountability and no shared production secret Unattended job requires a dedicated workload identity

Use this matrix as a decision process, not as an instruction to enable every option. First ask whether the target accepts Entra authentication, then whether the source supports direct managed identity, whether lifecycle requires a stable principal and whether trust must cross tenants. Only after that choose a credential flow. If the target does not support Entra authentication, managed identity cannot make that target accept its tokens; a separate credential or integration may remain necessary.

Practical example: App Service reading Key Vault without a client secret

Assume an existing test App Service, a dedicated test vault using the Azure RBAC permission model, and a harmless test secret. The operator needs permissions to configure the web app identity and assign roles at the vault scope. Confirm the subscription and tenant first; do not run these examples indiscriminately in production.

The simplest approach is to enable system-assigned identity in the application’s Identity blade, copy its principal ID, open the vault’s Access control (IAM) blade and assign the Key Vault Secrets User role to that principal. Restrict vault access to the intended environment. Do not assign Owner merely to avoid troubleshooting. If the application only needs one secret, consider narrower service-supported scope where appropriate, balanced against Microsoft’s recommendation to isolate vaults by application and environment.

An equivalent illustrative CLI setup is shown below. Replace the three environment variables with existing test resource names. This changes the test web app’s identity configuration and creates an access grant. The commands are documentation-based, not executed against a live subscription.

set -euo pipefail
: "${RG:?Set the test resource group}"
: "${APP:?Set the test App Service name}"
: "${VAULT:?Set the test vault name}"
az account show --query '{subscription:id,tenant:tenantId}' -o table
principal=$(az webapp identity assign -g "$RG" -n "$APP" \
  --query principalId -o tsv)
vault_id=$(az keyvault show -g "$RG" -n "$VAULT" \
  --query id -o tsv)
az role assignment create --assignee-object-id "$principal" \
  --assignee-principal-type ServicePrincipal \
  --role 'Key Vault Secrets User' --scope "$vault_id"

The ServicePrincipal principal type is correct even though the identity is managed. Explicitly passing its object ID and principal type also helps avoid directory lookup and replication issues during provisioning. See Microsoft’s role assignment CLI guidance and App Service identity documentation.

In production Python code, explicitly use a managed identity credential to avoid inadvertently succeeding with a developer or environment-based credential. Install compatible versions of azure-identity and azure-keyvault-secrets; configure the vault URL as a nonsecret environment variable. Use a test secret named health-check and never print its contents.

import os
from azure.identity import ManagedIdentityCredential
from azure.keyvault.secrets import SecretClient

credential = ManagedIdentityCredential()
with SecretClient(vault_url=os.environ['VAULT_URL'],
                  credential=credential) as client:
    client.get_secret('health-check')
    print('Test secret read succeeded')
credential.close()

This example expects the system-assigned identity. For a selected user-assigned identity, instantiate ManagedIdentityCredential(client_id=os.environ['MANAGED_IDENTITY_CLIENT_ID']) instead. A client ID is an identifier, not a client secret. For local development, choose an explicit developer credential or a deliberately configured development credential chain. A successful local SDK call is not proof that the deployed workload can authenticate.

To use a UAMI, create it in Managed Identities, record its client ID, principal ID and resource ID, assign the required target role and attach the identity to the App Service using its Identity settings. For CLI provisioning, see Microsoft’s UAMI CLI guide. If a service has separate deployment slot settings, inspect the actual slot configuration; do not assume identity is swapped with application code.

How much operational work can credential migration eliminate?

Managed identities have no separate usage charge for the identity itself, according to the managed identity overview. Application registrations and basic workload identity federation are also not the same thing as buying premium security capabilities. Entra Workload ID Premium licensing may be required for certain governance and Conditional Access features. Review the Workload ID FAQ and your agreement before budgeting. Compute, vault operations, logging and the engineering work still cost money.

Consider a team operating 24 independent application identities, each with one manually maintained credential. Its internal standard is four planned rotations per year. Assume each rotation consumes 45 minutes of engineer time including deployment, validation and recordkeeping, and the blended labor rate is $80 per hour. These are hypothetical inputs, not Microsoft rates or measured industry averages.

Metric Before migration After migration
Identities with manually rotated credential 24 6
Direct managed identities 0 12
Federated identities without stored Azure credential 0 6
Planned rotation events per year 96 24
Annual engineer hours for rotations 72 18
Annual rotation labor cost $5,760 $1,440

The migration removes 18 of 24 planned credential-rotation obligations, or 75%. Gross annual labor capacity released is 54 hours, equivalent to $4,320 at the assumed rate. Suppose implementation requires 40 engineer hours ($3,200) and ongoing federation/identity reviews require an extra six hours per year ($480). Net annual recurring labor benefit is $3,840; modeled payback is $3,200 / ($3,840 / 12) = 10 months. First-year net benefit is $640 assuming full-year savings start immediately after implementation. Calendar payback from project kickoff may be longer if the migration is phased.

Annual rotation labor falls from 5760 dollars to 1440 dollars; additional review labor is 480 dollars
Illustrative labor model; the released hours are not necessarily cash savings unless staffing or contracted expenditure changes.
Rotation time per event Annual gross released labor Annual net after $480 review cost Payback after completion
15 minutes $1,440 $960 40 months
45 minutes $4,320 $3,840 10 months
90 minutes $8,640 $8,160 4.71 months

The calculation intentionally excludes avoided outages and security incidents because assigning a monetary value to those requires evidence about incident frequency, impact and the change in risk. A migration may still be worthwhile for security reasons even if labor payback is weak. Conversely, a team that already uses federation may have little rotation labor to save by switching identity types.

Sharing identities: an original access-exposure model

Suppose four application components each have three independent Azure hosting resources. Each component needs access to exactly two of eight target resources. For illustration, every host can exercise the full target scope of its attached identity, and each target is counted equally. The metric is the number of host-target access relationships, not the number of principals and not a prediction of compromise probability.

Design Principals Role assignments (one per target per principal) Host-target access pairs
One shared UAMI with all eight targets 1 8 96
One dedicated UAMI per component (three hosts each) 4 8 24
One SAMI per host, scoped to two required targets 12 24 24

The first design appears efficient because it has only one principal and eight assignments. But it allows every hosting resource to access all eight targets. The second design has the same total number of assignments and 75% fewer modeled access relationships. The third has identical modeled host-target exposure but isolates each host into its own principal, which may improve revocation or attribution at the cost of more assignments and provisioning work.

One shared identity reaches 96 host-target pairs, while component-scoped and host-scoped identities each reach 24
Original access-scope model. Fewer principals does not automatically mean less reachable data.

The second design is not universally superior. If each replica processes a different customer’s confidential information, grouping those replicas could be unacceptable. If a fleet consists of disposable hosts that perform the same task, assigning individual identities might add operational work without meaningful target-level separation. Record the actual identity-to-target permission matrix, not merely the number of objects in Entra. Count network and data-plane restrictions separately rather than assuming every authorized request is reachable.

How to migrate from a secret-based service principal safely

Do not delete an existing application registration at the start of a migration. Its credentials, role assignments, app permissions and external consumers may have separate lifecycles. Instead, use a dependency-based cutover.

1. Establish an identity inventory

Record the application name, tenant, client and object IDs, credential types and expiration dates, owners, source hosts, scheduled jobs and every target resource. Include API permissions, group memberships, database grants and deployment service connections; Azure RBAC alone will not enumerate every access path. Cross-check Entra service principal sign-ins, workload-specific logs and actual application configurations. A principal that has not signed in recently may belong to a quarterly maintenance job.

2. Choose the target architecture and reduce permissions

Map every legitimate operation to the minimum permissions required. Do not copy broad Contributor or Owner roles blindly. Establish separate runtime and deployment identities: a web application’s runtime may need only Blob read and one vault secret, whereas its deployment pipeline may need management actions on a dedicated resource group. Preserve the existing identity while testing, but document the overlap and its expiration.

3. Introduce the new authentication path

Attach the appropriate managed identity or configure federation. Apply narrowly scoped authorization. Confirm networking, private endpoint DNS and service-specific data permissions before changing the application. Use the SDK’s explicit identity selection in production. Keep the previous authentication path available for a controlled, time-limited rollback, without silently falling back when a new identity fails.

4. Validate positive and negative cases

A successful connection is necessary but not sufficient. Confirm the principal performing the call, validate denied operations as well as allowed operations, and test scheduled jobs, scale-out and replacement instances. Use dedicated test data and avoid destructive tests against production resources.

Test Expected evidence
Runtime reads intended secret Successful read by new principal; no secret in logs
Runtime accesses unrelated vault Denial; no inherited broad grant
Runtime attempts management change in test scope Denial where not required
Pipeline from approved environment Federated login and authorized test deployment
Pipeline from disallowed branch/environment Trust exchange rejected
Application restarts with old secret absent Startup and scheduled operation succeed
Replacement host uses correct identity Expected principal ID and target access
Private endpoint access DNS resolves correctly and network path is permitted
Monitoring Principal and operation visible in relevant logs
Old credential retirement Configuration and credential records removed after rollback window

5. Retire the old credential, not necessarily the entire app

Once all consumers pass validation and rollback is no longer needed, revoke the obsolete secret or certificate. Remove copies from CI variables, deployment configuration, vaults and other storage as applicable, including historical exposure handling under your incident policy. Remove obsolete authorization grants. Only delete an application or principal after verifying that no other tenant, API integration or scheduled job depends on it. Do not merely disable an app’s secret-based code path and leave the credential active indefinitely.

Microsoft’s service-account governance guidance provides additional lifecycle and review considerations.

A measurable retirement gate

In the 24-identity example, assume 18 new authentication paths pass their positive tests, but only 15 old credentials have actually been revoked and three still serve unverified scheduled consumers. Report both figures. Migration coverage is 18/24 = 75%; verified removal of manually rotated credentials is 15/24 = 62.5%. It would be premature to claim the full 75% rotation reduction. Record the three outstanding dependencies, owners and scheduled retests. A migration status dashboard that counts only successful new logins hides the coexistence risk.

Security trade-offs beyond secret rotation

Control area Managed identity Application principal
Credential exposure No accessible platform-managed long-lived secret Depends on credential choice; federation avoids stored Azure secret
Host compromise Authorized code can request/use tokens Authorized code can request/use tokens
Trust scope Host attachment and optional UAMI federation Credential configuration and app permissions
Conditional Access for workload identities Not covered by current workload CA policy Eligible directly targeted single-tenant service principals with required licensing
Lifecycle reviews Verify attachments, roles and orphaned UAMIs Verify owners, credentials, consent and roles
Emergency containment Host isolation, identity/permission changes, resource controls Revoke credential or disable principal where appropriate, remove access, isolate workloads

Microsoft documents that workload Conditional Access does not cover managed identities, and that eligible service principals must be targeted directly rather than through a group. This is an important distinction: moving to managed identity may remove secret exposure without preserving every previous security control. Do not assume that ordinary user MFA policies apply to app-only token acquisition. Use appropriate workload controls instead.

Protect the source host, restrict execution permissions and monitor administrative changes to the identity. For UAMI, include the right to assign it to a resource in your privileged-access audit. For federation, review who can modify repository workflows, identity provider subject configuration or service connection approvals. For application registrations, examine ownership because an owner capable of adding credentials may obtain the application’s effective permissions. Monitor service principal and managed identity sign-ins alongside target resource audit logs; the precise availability and retention of logs depend on configuration and licensing.

Troubleshooting managed identity and service principal failures

Start by identifying the layer where the failure occurred. Is the source unable to obtain a token, is the token rejected, or is the target denying a correctly authenticated principal? The same HTTP status can have different causes depending on the service; use its error body and correlation ID rather than inferring the cause from status alone.

Symptom First checks Likely corrective action
Managed identity unavailable Actual host supports identity; attached and enabled; SDK selection Enable/attach correct identity, select correct client ID
AADSTS70021 / no matching trust Issuer, subject, audience, tenant; propagation Correct exact trust configuration, bounded retry
Invalid or expired client secret Credential expiration and app client ID Replace using controlled rotation or migrate to federation
HTTP 401 from target Token audience, tenant, expiration, resource endpoint Request correct resource token; inspect authentication setup
HTTP 403 from target Principal ID, target role, data-plane permissions, firewall Fix specific missing grant or networking issue
Role assignment cannot find principal Newly created principal, object ID vs client ID Use object ID and explicit principal type; retry propagation
Works locally, fails in Azure Local account vs actual deployed credential Test explicit managed identity on host
Works in one deployment slot only Slot-specific identity, role and network settings Configure and test intended slot
Old group permissions still appear Token claims and platform caching Account for cache and use direct role grants when appropriate

One subtle issue is managed identity token caching. Microsoft notes that the underlying infrastructure caches tokens per resource URI for about 24 hours, so changes to group or role membership reflected in token claims may take hours to become effective, and there is no supported way to force refresh before expiry. This is not a claim that every Azure RBAC change takes 24 hours. Direct resource role assignments and the target’s own authorization caches have different propagation characteristics. See the managed identity best-practice recommendations.

For urgent containment, follow an incident-specific response plan rather than waiting for a group membership change. Isolate the compromised workload, restrict access at the target where possible and coordinate identity disablement or access removal with service owners. Test containment and monitor residual access because previously issued tokens and service caches may outlive a configuration change.

Frequently asked questions

Is a managed identity the same as a service principal?

A managed identity is represented by a special type of service principal. The conventional comparison is between that Azure-managed identity and a service principal associated with an application registration. They have different provisioning and credential-management models.

Can a service principal authenticate without a secret?

Yes. Workload identity federation uses a trusted external assertion rather than a stored Azure client secret. Certificates also avoid a client secret string, but require private-key protection and certificate lifecycle management. The credential choice is distinct from the identity object type.

Can I use managed identity outside Azure?

Direct managed identity authentication requires a supported host integration. A user-assigned managed identity can also act as a federation trust target for supported external workloads, such as GitHub Actions or Kubernetes. This is different from trying to use an Azure VM metadata endpoint on a laptop.

Does a managed identity replace Key Vault?

No. It can remove the Azure credential used to authenticate to a vault, and it may eliminate downstream credentials when the target supports Entra. Key Vault still has important uses for certificates, cryptographic keys and secrets required by systems without token authentication.

Can I use a managed identity with Microsoft Graph?

Yes, supported app-only Graph access can be granted through application-role assignments to the managed identity’s service principal. There is no normal app registration for the managed identity. Follow Microsoft’s managed identity app-role assignment guide; request only necessary roles and ensure the operator has the required directory authorization. Azure subscription roles are not Graph permissions.

Can I change a service principal into a managed identity without changing its object ID?

Do not plan on converting an existing application service principal into a managed identity in place. Create the managed identity, grant the necessary permissions, migrate the consumers and validate the new identity. If the app registration must remain, consider federating its authentication instead, subject to supported trust configurations.

Which is better for Terraform?

Choose the authentication method according to where Terraform runs and the provider’s support. For a supported Azure-hosted runner, a dedicated managed identity can be appropriate. For GitHub or Azure DevOps hosted runners, federation is usually a stronger starting point than a stored secret. The deployment identity still requires narrowly scoped management permissions; separately evaluate the identity used for the state backend.

The bottom line

Choose the identity architecture by workload, permission boundary and lifecycle, and choose the authentication mechanism separately. Direct managed identity is usually the simplest option for supported Azure hosts. Federation makes both app registrations and UAMIs useful for external workloads without persistent Azure secrets. Application service principals remain essential for app-registration-specific and multitenant requirements. A certificate is an alternative when federation is unavailable, and a client secret should be a carefully governed fallback rather than the default.

Measure the real outcome: authorized workload operations, denied unnecessary operations, obsolete credentials revoked and effective permissions narrowed. An identity migration that produces a successful token but leaves an old powerful credential active is not complete.

About the Author: Jian Brant

Founder Jian Brant
Jian Brant is a technology professional and founder of Punch5Media, with extensive experience in web development, enterprise IT, business analysis and digital transformation. Drawing on his experience across public and private sector organizations, he delivers thoroughly researched, practical insights into technology, cybersecurity, software and digital business.

Share this article

Explore technology

Practical, independent technology guides and explanations.

Browse all articles →

Recent articles

Our editorial approach

Clear explanations, practical guidance and responsible research.

Editorial standards →