Skip to content

Fix CI NuGet restore on 1ES pool#4863

Open
liliankasem wants to merge 6 commits intovnextfrom
fix/ci-nuget-restore
Open

Fix CI NuGet restore on 1ES pool#4863
liliankasem wants to merge 6 commits intovnextfrom
fix/ci-nuget-restore

Conversation

@liliankasem
Copy link
Copy Markdown
Member

Problem

NuGet restore fails on 1ES hosted agents with:

NU1301: Unable to load the service index for source https://api.nuget.org/v3/index.json
An attempt was made to access a socket in a way forbidden by its access permissions. (api.nuget.org:443)

1ES pool agents block direct outbound access to api.nuget.org:443.

Fix

  1. Add NuGetAuthenticate@1 task before NuGet restore — authenticates to internal ADO feeds so packages can resolve through their upstream sources (which proxy nuget.org).
  2. Reorder NuGet.Config — move internal ADO feeds before nuget.org so the restore tries authenticated internal feeds first. nuget.org is kept as a fallback for local dev.

Changes

  • eng/ci/templates/steps/restore-nuget.yml — added NuGetAuthenticate step
  • NuGet.Config — reordered feeds (internal first, nuget.org last)

- Add NuGetAuthenticate@1 task before restore to authenticate to
  internal ADO feeds (1ES pools block direct nuget.org access)
- Reorder NuGet.Config to prioritize internal ADO feeds over nuget.org
  so packages resolve through upstream sources first

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@liliankasem liliankasem requested a review from a team as a code owner April 20, 2026 18:40
@liliankasem liliankasem force-pushed the fix/ci-nuget-restore branch 2 times, most recently from 2825e3b to 5ff5afd Compare April 20, 2026 19:00
@liliankasem liliankasem force-pushed the fix/ci-nuget-restore branch 2 times, most recently from 1c28259 to 2ec1dd6 Compare April 20, 2026 20:51
1ES CFSClean policy blocks direct access to api.nuget.org in CI.

- Add nuget-upstream feed (ADO feed with nuget.org as upstream source)
  to NuGet.Config so packages resolve through the internal feed
- Strip direct nuget.org source in CI restore step (kept for local dev)
- Add NuGetAuthenticate for ADO feed auth
- Remove networkIsolationPolicy overrides (CFS is org-enforced)
@liliankasem liliankasem force-pushed the fix/ci-nuget-restore branch from 2ec1dd6 to 2cf5724 Compare April 20, 2026 21:23
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