Skip to content

Support Azure Arc user-assigned managed identity - #50371

Open
vcolin7 wants to merge 1 commit into
mainfrom
vcolin7-identity-arc-uami-msal
Open

Support Azure Arc user-assigned managed identity#50371
vcolin7 wants to merge 1 commit into
mainfrom
vcolin7-identity-arc-uami-msal

Conversation

@vcolin7

@vcolin7 vcolin7 commented Sep 5, 2026

Copy link
Copy Markdown
Member

Description

Azure Identity routed Azure Arc token requests through MSAL, but both Java identity implementations rejected user-assigned identities before MSAL could handle them. MSAL4J 1.26.0 adds Arc UAMI selector forwarding and fail-closed identity confirmation, so this change removes the obsolete Arc preflight restriction.

  • Upgrades the shared msal4j dependency to 1.26.0 for all tagged consumers.
  • Enables Arc UAMI in azure-identity and azure-identity-v2, while preserving the Cloud Shell and Service Fabric restrictions.
  • Removes the legacy UAMI rejection from ArcIdentityCredential.
  • Fixes the v2 chained-credential success-path logging issue exposed by DefaultAzureCredential coverage.
  • Adds direct client/resource/object ID and DefaultAzureCredential client/resource ID regression coverage, plus related documentation and changelog entries.

Validation

  • Focused managed identity and default credential tests: 66 v1 tests and 7 v2 tests.
  • Maven verification for azure-identity, azure-identity-broker, and azure-identity-v2.
  • Legacy Event Hubs compatibility build.
  • Dependency trees resolve msal4j:1.26.0.
  • Live TME testing on a TPM-backed Arc 1.67 host confirmed all v1/v2 direct and default-credential selector paths returned the expected UAMI oid.
  • Live negative tests confirmed an unattached UAMI returns identity_not_found instead of falling back to the system identity.
  • The shared Arc fixture also validated Key Vault secret access with the positive UAMI.

Fixes: #50233

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

Written with the help of vcolin7-copilot.

Upgrade MSAL4J to 1.26.0 and allow Arc UAMI requests to reach MSAL in both identity implementations. Preserve the existing Cloud Shell and Service Fabric restrictions, and cover direct and DefaultAzureCredential selector paths.
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
35 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new DefaultAzureCredential Arc UAMI regression test doesn’t currently assert that the configured selector (clientId vs resourceId) is actually propagated, so it may not reliably catch regressions.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR enables Azure Arc user-assigned managed identity (UAMI) support in the Java Identity libraries by removing legacy Arc-specific UAMI preflight rejection now that MSAL4J 1.26.0 can correctly handle Arc UAMI selection, and by adding regression coverage and documentation updates.

Changes:

  • Upgraded com.microsoft.azure:msal4j to 1.26.0 across the repo’s tagged consumers and version tracking.
  • Removed the Arc UAMI preflight restriction (while keeping Cloud Shell and Service Fabric restrictions) and removed the legacy Arc-only UAMI guard.
  • Added/expanded tests and docs/CHANGELOG entries for Arc UAMI selection (client/resource/object ID where applicable) and fixed v2 chained-credential success-path logging.
File summaries
File Description
sdk/identity/azure-identity/src/test/java/com/azure/identity/ManagedIdentityCredentialTest.java Adds Arc UAMI selector regression tests (client/resource/object ID) and keeps Cloud Shell/Service Fabric restriction coverage.
sdk/identity/azure-identity/src/test/java/com/azure/identity/DefaultAzureCredentialTest.java Adds DefaultAzureCredential Arc UAMI tests (client/resource ID).
sdk/identity/azure-identity/src/main/java/com/azure/identity/ManagedIdentityCredentialBuilder.java Documents Arc UAMI selector support.
sdk/identity/azure-identity/src/main/java/com/azure/identity/ManagedIdentityCredential.java Removes Arc from the UAMI preflight rejection; retains Cloud Shell and Service Fabric rejections.
sdk/identity/azure-identity/src/main/java/com/azure/identity/ArcIdentityCredential.java Removes legacy Arc UAMI rejection so MSAL can handle Arc UAMI selection.
sdk/identity/azure-identity/README.md Documents Arc UAMI support and selector options for ManagedIdentityCredential/DefaultAzureCredential.
sdk/identity/azure-identity/pom.xml Updates msal4j dependency to 1.26.0 (and associated tracking entries).
sdk/identity/azure-identity/CHANGELOG.md Adds feature note for Arc UAMI and dependency update entry for msal4j 1.26.0.
sdk/identity/azure-identity-broker/pom.xml Updates msal4j dependency to 1.26.0 (and associated tracking entries).
sdk/identity-v2/azure-identity/src/test/java/com/azure/v2/identity/ManagedIdentityCredentialTest.java Adds v2 Arc UAMI selector regression tests and Cloud Shell restriction coverage.
sdk/identity-v2/azure-identity/src/test/java/com/azure/v2/identity/DefaultAzureCredentialTest.java Adds v2 DefaultAzureCredential Arc UAMI selector tests and verifies credential caching behavior.
sdk/identity-v2/azure-identity/src/main/java/com/azure/v2/identity/ManagedIdentityCredentialBuilder.java Documents Arc UAMI selector support in v2 builder.
sdk/identity-v2/azure-identity/src/main/java/com/azure/v2/identity/ManagedIdentityCredential.java Removes Arc from the v2 UAMI preflight rejection; retains Cloud Shell rejection.
sdk/identity-v2/azure-identity/src/main/java/com/azure/v2/identity/ChainedTokenCredential.java Fixes v2 success-path logging to reference the correct credential instance.
sdk/identity-v2/azure-identity/pom.xml Updates msal4j dependency to 1.26.0 (and associated tracking entries).
sdk/identity-v2/azure-identity/CHANGELOG.md Adds feature note for Arc UAMI, bug fix note, and dependency update entry for msal4j 1.26.0.
sdk/eventhubs/microsoft-azure-eventhubs/pom.xml Updates test-scope msal4j to 1.26.0 for compatibility validation.
eng/versioning/external_dependencies.txt Updates recorded msal4j external dependency version to 1.26.0.
Review details
  • Files reviewed: 18/18 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +135 to +139
= mockConstruction(IdentityClient.class, (identityClient, context) -> {
when(identityClient.authenticateWithAzureDeveloperCli(request)).thenReturn(Mono.empty());
when(identityClient.authenticateWithManagedIdentityMsalClient(request))
.thenReturn(TestUtils.getMockAccessToken(token, expiresAt));
});
Comment on lines +69 to +72
AccessToken firstToken = credential.getToken(request);
AccessToken cachedToken = credential.getToken(request);
Assertions.assertEquals(token, firstToken.getToken());
Assertions.assertEquals(token, cachedToken.getToken());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Untriaged

Development

Successfully merging this pull request may close these issues.

[Identity] Support Azure Arc user-assigned managed identity (UAMI) via MSAL

2 participants