Skip to content

[release/11.0] Backport refreshable Helix Entra authentication - #17561

Merged
missymessa merged 5 commits into
dotnet:release/11.0from
missymessa:users/mjanecke/backport-17537-release-11.0
Sep 15, 2026
Merged

missymessa merged 5 commits into
dotnet:release/11.0from
missymessa:users/mjanecke/backport-17537-release-11.0

Conversation

@missymessa

@missymessa missymessa commented Sep 14, 2026 •

Copy link
Copy Markdown
Member

Summary

Backports refreshable Helix Entra authentication to release/11.0 for AB#12269.

Validation

  • Build.cmd -configuration Release -projects src\Microsoft.DotNet.Helix\Sdk.Tests\Microsoft.DotNet.Helix.Sdk.Tests\Microsoft.DotNet.Helix.Sdk.Tests.csproj -test
  • 327 tests passed, 0 failed, 0 skipped
  • Microsoft.DotNet.Helix.JobMonitor built successfully as a referenced project

missymessa and others added 3 commits September 14, 2026 12:54
Copilot-Session: e890b71a-c1aa-416c-a15c-be8da9fdd9b4
Copilot-Session: 0e1a942f-a44f-4e3a-8d35-af3fe8bee535
Co-authored-by: Copilot <[email protected]>
Copilot-Session: a6ad3a92-2023-4c67-8948-f6d34de1a67c
Copilot-Session: 521e657d-a005-4f60-bcff-25a05ebcc390
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Copilot-Session: 4aa6b2e8-2313-40c0-92f6-1d578db0af15
Copilot-Session: a891597e-6dca-4706-8628-004c5837d0c9

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 existing public constructor changes behavior for custom TokenCredential consumers and requires compatibility handling.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Backports refreshable Helix Entra authentication to the release/11.0 branch.

Changes:

  • Adds Entra token scopes, refresh, and authentication modes.
  • Propagates authentication through SDK tasks, Job Monitor, and pipelines.
  • Adds tests, source-build guards, and documentation.
File summaries
File Description
src/Microsoft.DotNet.Helix/Sdk/tools/Microsoft.DotNet.Helix.Sdk.props Defines authentication properties.
src/Microsoft.DotNet.Helix/Sdk/tools/Microsoft.DotNet.Helix.Sdk.MultiQueue.targets Propagates authentication to multi-queue tasks.
src/Microsoft.DotNet.Helix/Sdk/tools/Microsoft.DotNet.Helix.Sdk.MonoQueue.targets Propagates authentication to job submission.
src/Microsoft.DotNet.Helix/Sdk/tools/download-results/DownloadFromResultsContainer.targets Propagates authentication to result downloads.
src/Microsoft.DotNet.Helix/Sdk/SendHelixJob.cs Validates authenticated job submission.
src/Microsoft.DotNet.Helix/Sdk/Readme.md Documents Entra configuration.
src/Microsoft.DotNet.Helix/Sdk/Microsoft.DotNet.Helix.Sdk.csproj Adds integration dependencies and source-build guards.
src/Microsoft.DotNet.Helix/Sdk/HelixTask.cs Creates PAT, anonymous, or Entra clients.
src/Microsoft.DotNet.Helix/Sdk/GetHelixWorkItems.cs Handles authentication for work-item retrieval.
src/Microsoft.DotNet.Helix/Sdk/CancelHelixJob.cs Supports authenticated cancellation.
src/Microsoft.DotNet.Helix/Sdk.Tests/Microsoft.DotNet.Helix.Sdk.Tests/QueueStatsLoggingTests.cs Tests creator validation.
src/Microsoft.DotNet.Helix/Sdk.Tests/Microsoft.DotNet.Helix.Sdk.Tests/Microsoft.DotNet.Helix.Sdk.Tests.csproj Updates test project references.
src/Microsoft.DotNet.Helix/Sdk.Tests/Microsoft.DotNet.Helix.Sdk.Tests/HelixApiAuthenticationTests.cs Tests scopes, refresh, and authentication selection.
src/Microsoft.DotNet.Helix/JobMonitor/Microsoft.DotNet.Helix.JobMonitor.csproj Adds integration dependencies and source-build guards.
src/Microsoft.DotNet.Helix/JobMonitor/JobMonitorRunner.cs Adds Entra client creation and warnings.
src/Microsoft.DotNet.Helix/JobMonitor/JobMonitorOptions.cs Adds Entra monitor configuration.
src/Microsoft.DotNet.Helix/Client/CSharp/HelixApiOptions.cs Adds authentication modes, scopes, and bearer policy.
src/Microsoft.DotNet.Helix/Client/CSharp/ApiFactory.cs Adds Entra client factories.
eng/common/core-templates/steps/send-to-helix.yml Configures pipeline Entra authentication.
eng/common/core-templates/job/job.yml Clarifies legacy token handling.
eng/common/core-templates/job/helix-job-monitor.yml Configures monitor-job Entra authentication.
Documentation/AzureDevOps/SendingJobsToHelix.md Documents authentication setup.
Review details
  • Files reviewed: 22/22 changed files
  • Comments generated: 1
  • Review effort level: Lite

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

Keep existing TokenCredential constructors on the token authentication policy and use explicit scopes only through the new Entra factories. Add coverage for custom-host legacy credentials.

Co-authored-by: Copilot <[email protected]>

Copilot-Session: 4aa6b2e8-2313-40c0-92f6-1d578db0af15
Copilot AI review requested due to automatic review settings September 14, 2026 21:18

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.

🔵 Needs a closer look

Two moderate Entra-mode URL issues remain unresolved; source-build guidance also needs updating.

Review details

Suppressed comments (3)

src/Microsoft.DotNet.Helix/Sdk/Readme.md:32

  • This new guidance omits the source-build limitation: Microsoft.DotNet.Helix.Sdk deliberately excludes Microsoft.DotNet.ArcadeAzureIntegration for source-only builds and CreateEntraHelixApi throws PlatformNotSupportedException there. Without noting that limitation, source-build users are told that Entra is an available alternative but will get a runtime failure.
- `HelixUseEntraAuthentication=true` with an available `DefaultIdentityTokenCredential`, or

src/Microsoft.DotNet.Helix/Sdk/tools/Microsoft.DotNet.Helix.Sdk.MonoQueue.targets:86

  • When Entra is enabled while a legacy HelixAccessToken is still present, this new auth path still reaches the target's _AccessTokenSuffix logic, which checks only whether HelixAccessToken is nonempty. The subsequent 'Sent Helix Job' URL therefore includes a PAT placeholder even though Entra is active and the PAT is intentionally ignored. Make the suffix conditional on HelixUseEntraAuthentication being false.
                  UseEntraAuthentication="$(HelixUseEntraAuthentication)"

src/Microsoft.DotNet.Helix/Sdk/tools/Microsoft.DotNet.Helix.Sdk.MultiQueue.targets:104

  • Entra mode still permits a legacy HelixAccessToken to be present (the new HelixTask path only warns and ignores it for API authentication). CheckHelixJobStatus is passed that token and builds its failure-log URL suffix from AccessToken alone, so an Entra-authenticated failure advertises a PAT-style ?access_token={Get this from helix.dot.net} link that cannot authenticate via Entra. Gate that suffix on !UseEntraAuthentication (or otherwise clear the token for this task).
      UseEntraAuthentication="$(HelixUseEntraAuthentication)"
  • Files reviewed: 22/22 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Copilot AI review requested due to automatic review settings September 14, 2026 21:25

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.

🔵 Needs a closer look

Address the two moderate token-cache issues and the two diagnostic URL suffix nits before approval.

Review details

Suppressed comments (4)

src/Microsoft.DotNet.Helix/JobMonitor/JobMonitorRunner.cs:825

  • This path constructs DefaultIdentityTokenCredential with its default short cache. That wrapper caches the returned AccessToken for a fixed three minutes without considering AccessToken.ExpiresOn (see src/Microsoft.DotNet.ArcadeAzureIntegration/TokenCredentialShortCache.cs:74-80), so if an identity returns a token with less than three minutes remaining, BearerTokenAuthenticationPolicy can request a refresh but receive the same expired token and Helix requests fail. Disable the short cache for this expiry-aware API client, or make the cache honor the token expiry, and cover the production credential path with a short-lived token test.
        return ApiFactory.GetAuthenticatedWithEntra(
            baseUri,
            new DefaultIdentityTokenCredential());

src/Microsoft.DotNet.Helix/Sdk/HelixTask.cs:100

  • This path constructs DefaultIdentityTokenCredential with its default short cache. That wrapper caches the returned AccessToken for a fixed three minutes without considering AccessToken.ExpiresOn (see src/Microsoft.DotNet.ArcadeAzureIntegration/TokenCredentialShortCache.cs:74-80), so if an identity returns a token with less than three minutes remaining, BearerTokenAuthenticationPolicy can request a refresh but receive the same expired token and Helix requests fail. Disable the short cache for this expiry-aware API client, or make the cache honor the token expiry, and cover the production credential path with a short-lived token test.
        return ApiFactory.GetAuthenticatedWithEntra(
            baseUri,
            new DefaultIdentityTokenCredential());

src/Microsoft.DotNet.Helix/Sdk/tools/Microsoft.DotNet.Helix.Sdk.MonoQueue.targets:86

  • This opt-in can still leave HelixAccessToken populated, but the _AccessTokenSuffix below is conditioned only on that property. As a result, Entra-enabled submissions with a legacy token produce a misleading PAT-style work-items URL even though the token is ignored. Also require $(HelixUseEntraAuthentication) != 'true' when creating the suffix.
                  UseEntraAuthentication="$(HelixUseEntraAuthentication)"

src/Microsoft.DotNet.Helix/Sdk/tools/Microsoft.DotNet.Helix.Sdk.MultiQueue.targets:104

  • When Entra is enabled while a legacy HelixAccessToken is still present, CheckHelixJobStatus still derives its failure-log URL suffix solely from AccessToken, so it emits a PAT-style ?access_token={Get this from helix.dot.net} link even though the task explicitly ignores that token. Gate that suffix on !UseEntraAuthentication (and cover the mixed-input case) so diagnostics match the selected authentication mode.
      UseEntraAuthentication="$(HelixUseEntraAuthentication)"
  • Files reviewed: 22/22 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@missymessa
missymessa enabled auto-merge (squash) September 14, 2026 23:18
@missymessa
missymessa merged commit cd183dd into dotnet:release/11.0 Sep 15, 2026
17 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-rc2 milestone Sep 15, 2026
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.

3 participants