Skip to content

Migrate VS insertion from RIT+PAT to roslyn-tools CLI+WIF#13010

Merged
davidwengier merged 2 commits intodotnet:mainfrom
missymessa:missymessa-10097-wif
Apr 10, 2026
Merged

Migrate VS insertion from RIT+PAT to roslyn-tools CLI+WIF#13010
davidwengier merged 2 commits intodotnet:mainfrom
missymessa:missymessa-10097-wif

Conversation

@missymessa
Copy link
Copy Markdown
Member

Summary

Replace the RoslynTools.VisualStudioInsertionTool (RIT) with the roslyn-tools create-insertion CLI for VS insertion PRs. The CLI supports bearer token authentication via DefaultAzureCredential, enabling migration from the dn-bot-dnceng-build-e-code-full-release-e-packaging-r PAT to a Workload Identity Federation (WIF) service connection for the dnceng AzDO org.

Changes

eng/pipelines/insert.yml

  • Replace NuGet-based RIT install with dotnet tool install Microsoft.RoslynTools
  • Remove buildUserName, buildPassword, componentUserName, componentPassword parameters
  • Add devDivAzdoToken (for DevDiv org, still PAT-based) and dncEngAzureSubscription (WIF service connection) parameters
  • Replace OneOffInsertion.ps1 execution with AzureCLI@2 task running roslyn-tools create-insertion
  • The AzureCLI@2 task authenticates via the WIF service connection, enabling roslyn-tools to acquire a dnceng bearer token via DefaultAzureCredential (AzureCliCredential)
  • Remove prid.txt report step (CLI outputs PR URL to stdout)

azure-pipelines-official.yml

  • Pass devDivAzdoToken and dncEngAzureSubscription instead of username/password pairs

Auth Details

  • dnceng org: Uses WIF service connection DncEng Insertion: Roslyn and Razor (Entra app: Roslyn-Razor-Insertion-DncEng)
  • DevDiv org: Still uses dn-bot-devdiv-build-e-code-full-release-e-packaging-r PAT (DevDiv migration is separate)

Context

Part of PAT migration work item dnceng/internal#10097.
cc @dotnet/razor-compiler

@missymessa missymessa requested a review from a team as a code owner April 3, 2026 22:20
@missymessa
Copy link
Copy Markdown
Member Author

Hey Razor team, let me know how I can best test this so I can make sure the Service Connection works here. Thanks!

@davidwengier
Copy link
Copy Markdown
Member

Val build: https://dev.azure.com/dnceng/internal/_build/results?buildId=2943458&view=results

@missymessa
Copy link
Copy Markdown
Member Author

@davidwengier Thanks! I'll work on a fix.

Replace the RoslynTools.VisualStudioInsertionTool (RIT) with the roslyn-tools
create-insertion CLI, which supports bearer token auth via DefaultAzureCredential.
The dnceng AzDO connection now uses a WIF service connection ('DncEng Insertion:
Roslyn and Razor') instead of the dn-bot-dnceng-build-e-code-full-release-e-packaging-r PAT.

The DevDiv token (dn-bot-devdiv-build-e-code-full-release-e-packaging-r) is still
passed as a PAT since DevDiv org auth is separate.

Part of dnceng/internal work item 10097.
@missymessa missymessa force-pushed the missymessa-10097-wif branch from ed84be4 to 73f5fdd Compare April 8, 2026 01:13
…eCredential

DefaultAzureCredential on build agents may pick up the agent's managed identity
rather than the WIF service connection's SP. Explicitly acquire the token via
'az account get-access-token' within the AzureCLI@2 task context, where the
correct SP is already logged in via federated token.
@missymessa
Copy link
Copy Markdown
Member Author

Update (April 9, 2026): Explicit AzDO token for dnceng auth

Previous builds were failing with VS30063: You are not authorized to access https://dev.azure.com on the dnceng auth step. The root cause was that passing "unset" to --dnceng-azdo-token made roslyn-tools fall back to DefaultAzureCredential, which on pipeline agents picks up the agent's managed identity instead of the WIF service connection's service principal.

Fix in 8b14f5f: Instead of relying on DefaultAzureCredential, the script now explicitly acquires the AzDO token via az account get-access-token --resource 499b84ac-... inside the AzureCLI@2 task — where the WIF SP is already logged in — and passes it directly as --dnceng-azdo-token.

Service Principal details:

Field Value
Display Name Roslyn-Razor-Insertion-DncEng
App (client) ID 18d7b424-c071-42b1-ac01-4baa5a8c3940
Object ID 84662b45-6b76-4d0a-9703-06ff7193f3ec
Service Connection DncEng Insertion: Roslyn and Razor (ID 2583f316-1de6-489a-a49b-29ed5ab06308, type azurerm with WIF)
FIC AzDO-DncEng-Internal-Insertion-ARM
Azure RBAC Reader on Helix subscription 68672ab8-de0c-40f1-8d1b-ffb20bd62c0f
AzDO enrollment dnceng (Readers, Build Administrators, Project Contributors) + devdiv (via WI 2905236)

Build 2946752 queued with this fix.

@missymessa
Copy link
Copy Markdown
Member Author

Work item: dnceng/internal#10097

@missymessa
Copy link
Copy Markdown
Member Author

@davidwengier I think this is good to go, if you're good with the testing done.

Copy link
Copy Markdown
Member

@davidwengier davidwengier left a comment

Choose a reason for hiding this comment

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

If you're happy, I'm happy

@JoeRobich
Copy link
Copy Markdown
Member

/backport to stable

@github-actions
Copy link
Copy Markdown

Started backporting to stable (link to workflow run)

@JoeRobich
Copy link
Copy Markdown
Member

/backport to release/stable

@github-actions
Copy link
Copy Markdown

@JoeRobich an error occurred while backporting to stable. See the workflow output for details.

@github-actions
Copy link
Copy Markdown

Started backporting to release/stable (link to workflow run)

@JoeRobich
Copy link
Copy Markdown
Member

/backport to release/insiders

@github-actions
Copy link
Copy Markdown

Started backporting to release/insiders (link to workflow run)

@JoeRobich
Copy link
Copy Markdown
Member

/backport to release/dev18.3

@JoeRobich
Copy link
Copy Markdown
Member

/backport to release/dev18.0

@github-actions
Copy link
Copy Markdown

Started backporting to release/dev18.3 (link to workflow run)

@github-actions
Copy link
Copy Markdown

Started backporting to release/dev18.0 (link to workflow run)

@JoeRobich
Copy link
Copy Markdown
Member

/backport to release/dev17.14

@github-actions
Copy link
Copy Markdown

Started backporting to release/dev17.14 (link to workflow run)

@JoeRobich
Copy link
Copy Markdown
Member

/backport to release/dev17.12

@github-actions
Copy link
Copy Markdown

Started backporting to release/dev17.12 (link to workflow run)

JoeRobich added a commit that referenced this pull request Apr 22, 2026
…CLI+WIF (#13083)

Backport of #13010 to release/dev17.12

/cc @JoeRobich @missymessa

## Customer Impact

## Regression

- [ ] Yes
- [ ] No

[If yes, specify when the regression was introduced. Provide the PR or
commit if known.]

## Testing

[How was the fix verified? How was the issue missed previously? What
tests were added?]

## Risk

[High/Medium/Low. Justify the indication by mentioning how risks were
measured and addressed.]
JoeRobich added a commit that referenced this pull request Apr 22, 2026
…CLI+WIF (#13082)

Backport of #13010 to release/dev17.14

/cc @JoeRobich @missymessa

## Customer Impact

## Regression

- [ ] Yes
- [ ] No

[If yes, specify when the regression was introduced. Provide the PR or
commit if known.]

## Testing

[How was the fix verified? How was the issue missed previously? What
tests were added?]

## Risk

[High/Medium/Low. Justify the indication by mentioning how risks were
measured and addressed.]
JoeRobich added a commit that referenced this pull request Apr 22, 2026
…CLI+WIF (#13079)

Backport of #13010 to release/insiders

/cc @JoeRobich @missymessa

## Customer Impact

## Regression

- [ ] Yes
- [ ] No

[If yes, specify when the regression was introduced. Provide the PR or
commit if known.]

## Testing

[How was the fix verified? How was the issue missed previously? What
tests were added?]

## Risk

[High/Medium/Low. Justify the indication by mentioning how risks were
measured and addressed.]
JoeRobich added a commit that referenced this pull request Apr 22, 2026
…I+WIF (#13078)

Backport of #13010 to release/stable

/cc @JoeRobich @missymessa

## Customer Impact

## Regression

- [ ] Yes
- [ ] No

[If yes, specify when the regression was introduced. Provide the PR or
commit if known.]

## Testing

[How was the fix verified? How was the issue missed previously? What
tests were added?]

## Risk

[High/Medium/Low. Justify the indication by mentioning how risks were
measured and addressed.]
JoeRobich added a commit that referenced this pull request Apr 22, 2026
…LI+WIF (#13080)

Backport of #13010 to release/dev18.3

/cc @JoeRobich @missymessa

## Customer Impact

## Regression

- [ ] Yes
- [ ] No

[If yes, specify when the regression was introduced. Provide the PR or
commit if known.]

## Testing

[How was the fix verified? How was the issue missed previously? What
tests were added?]

## Risk

[High/Medium/Low. Justify the indication by mentioning how risks were
measured and addressed.]
JoeRobich added a commit that referenced this pull request Apr 22, 2026
…LI+WIF (#13081)

Backport of #13010 to release/dev18.0

/cc @JoeRobich @missymessa

## Customer Impact

## Regression

- [ ] Yes
- [ ] No

[If yes, specify when the regression was introduced. Provide the PR or
commit if known.]

## Testing

[How was the fix verified? How was the issue missed previously? What
tests were added?]

## Risk

[High/Medium/Low. Justify the indication by mentioning how risks were
measured and addressed.]
@JoeRobich JoeRobich modified the milestones: Next, 18.7 Apr 28, 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