Skip to content

Add Entra credential fallback to CreateAzdoClient (Phase 1, WI 10141)#16806

Merged
mmitche merged 1 commit into
dotnet:mainfrom
missymessa:migrate-dn-bot-all-orgs-build-rw-code-rw-10141-phase1
May 12, 2026
Merged

Add Entra credential fallback to CreateAzdoClient (Phase 1, WI 10141)#16806
mmitche merged 1 commit into
dotnet:mainfrom
missymessa:migrate-dn-bot-all-orgs-build-rw-code-rw-10141-phase1

Conversation

@missymessa
Copy link
Copy Markdown
Member

Summary

Phase 1 of migrating the dn-bot-all-orgs-build-rw-code-rw PAT from Basic auth to Entra-based authentication in the V3 publishing pipeline.

This PR contains only backward-compatible C# changes. YAML and secret manifest changes will follow in Phase 2 after this SDK version flows to consumers.

Why Phase 1/Phase 2?

The original PR #16785 was reverted (#16792) because it combined C# code changes (shipped in the Arcade SDK NuGet package) with YAML changes (take effect immediately on merge). After merge, the Maestro Build Promotion pipeline was still running the old SDK version (which required AzdoApiToken), but the YAML had already stopped passing it, causing:

error : The property AzdoApiToken is required when using streaming publishing, but doesn't have a value set.

Build: https://dev.azure.com/dnceng/internal/_build/results?buildId=2972977

Changes (C# only, PublishArtifactsInManifestBase.cs)

  • CreateAzdoClient(): When no PAT is provided, falls back to DefaultIdentityTokenCredential with bearer token for AzDO resource (499b84ac-1321-427f-aa17-267ca6975798/.default). Supports AzurePipelinesCredential (from AzureCLI@2 with addSpnToEnvironment:true), ManagedIdentityCredential, WorkloadIdentityCredential, and AzureCliCredential.
  • HasEntraCredentialsAvailable(): New method to check for available Entra credentials, used in validation to avoid false errors when streaming publishing is configured without a PAT.
  • AnyMissingRequiredBaseProperties(): Relaxed validation -- only errors on missing AzdoApiToken when Entra credentials are also unavailable.

What is NOT in this PR (Phase 2)

After this SDK version builds and flows to consumers:

  1. Remove /p:AzdoApiToken='$(dn-bot-all-orgs-build-rw-code-rw)' from publish.yml
  2. Remove PAT from binlog redaction list in publish-logs.yml
  3. Delete PAT entry from secret manifest (product-builds-engkeyvault.yaml)

Identity details

  • MI: maestro-build-promotion-mi (AppId: 6e870007-e236-4eb1-8734-8bf8cd54c748)
  • SC: maestro-build-promotion (ID: df3b9892-c5c9-4d64-8b72-edd72e049305, type: azurerm, auth: WorkloadIdentityFederation)
  • Enrollment: Confirmed in dnceng/internal Readers group

Work Item: https://dev.azure.com/dnceng/internal/_workitems/edit/10141

Phase 1 of migrating dn-bot-all-orgs-build-rw-code-rw from PAT to Entra auth.

This PR adds backward-compatible C# changes only:
- CreateAzdoClient(): When no PAT is provided, falls back to
  DefaultIdentityTokenCredential with bearer token for AzDO resource
  (499b84ac-1321-427f-aa17-267ca6975798/.default). Supports
  AzurePipelinesCredential (from AzureCLI@2 with addSpnToEnvironment:true),
  ManagedIdentityCredential, WorkloadIdentityCredential, and AzureCliCredential.
- HasEntraCredentialsAvailable(): New method to detect available Entra
  credentials, used in validation to avoid false errors.
- AnyMissingRequiredBaseProperties(): Relaxed validation - only errors on
  missing AzdoApiToken when Entra credentials are also unavailable.

The YAML and secret manifest changes are intentionally NOT included here.
They will be made in a Phase 2 PR after this SDK version flows to consumers,
to avoid the version mismatch that caused the revert of dotnet#16785.

Work Item: https://dev.azure.com/dnceng/internal/_workitems/edit/10141
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants