[CFS] Fix cargo feed auth for fork builds - #7318
Merged
Merged
Conversation
"cmake build All" fails in public PR validation for fork PRs with: token rejected for `azure-sdk-for-rust` failed to get successful HTTP response from .../_packaging/azure-sdk-for-rust/Cargo/index/config.json, got 401 TF400813: The user 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa' is not authorized Two problems, both already solved in azure-sdk-for-rust (eng/templates/config.toml.template and eng/pipelines/templates/steps/use-rust.yml): 1. The feed was the org-scoped azure-sdk-for-rust index with no ~force-auth suffix, so Azure DevOps answered the index anonymously. Point at the project-scoped public feed with ~force-auth, which reports auth-required and is the same crates.io upstream azure-sdk-for-rust consumes. 2. CargoAuthenticate@0 authenticates with SYSTEM_ACCESSTOKEN, which Azure DevOps does not deliver to fork builds. The task still reports success but writes the anonymous identity, so the failure only surfaces later when cargo fetches the index. NuGetAuthenticate@1 authenticates with the build's service connection, whose token fork builds do get, and publishes it as VSS_NUGET_ACCESSTOKEN; feed that to CargoAuthenticate@0 as SYSTEM_ACCESSTOKEN. NuGetAuthenticate@1 is declared in cmake-build.yml rather than taken from nuget-config.yml because archetype-sdk-client.yml includes cmake-build.yml without it. Validated on build 6688949: "cmake build All" 27/27 (was 22 failing), 39/40 jobs green, and CFSClean compliant on every job with crates.io traffic gone. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: f3a428db-e276-4363-afd9-a944e8533203
Daniel Jurek (danieljurek)
requested a review
from Mike Harder (mikeharder)
as a code owner
August 12, 2026 15:19
Daniel Jurek (danieljurek)
requested a review
from Ben Broderick Phillips (benbp)
as a code owner
August 12, 2026 15:19
|
Azure Pipelines: Successfully started running 2 pipeline(s). 8 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 started reviewing on behalf of
Daniel Jurek (danieljurek)
August 12, 2026 15:19
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes Azure DevOps fork-PR validation failures where Cargo can’t authenticate to the Azure Artifacts Cargo index (401/TF400813) by routing crates.io through the correct “force-auth” feed and ensuring CargoAuthenticate receives a token that is available in fork builds.
Changes:
- Update the cargo
config.toml.templateto use the project-scopedazure-sdk-for-rust-public~force-authfeed endpoint. - Add
NuGetAuthenticate@1beforeCargoAuthenticate@0and passVSS_NUGET_ACCESSTOKENasSYSTEM_ACCESSTOKENto work around missingSystem.AccessTokenin fork builds.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| eng/templates/config.toml.template | Switches the Cargo registry/source replacement to the project-scoped ~force-auth feed to avoid anonymous index access. |
| eng/pipelines/templates/steps/cmake-build.yml | Ensures fork builds get a usable artifacts token via NuGetAuthenticate@1, then supplies it to CargoAuthenticate@0. |
Suppressed comments (1)
eng/pipelines/templates/steps/cmake-build.yml:53
- This task's display name still says
azure-sdk-for-rust, but the config points cargo at theazure-sdk-for-rust-public~force-authfeed. Updating the display name will reduce confusion when diagnosing feed/auth issues from logs.
- task: CargoAuthenticate@0
displayName: Authenticate cargo to the azure-sdk-for-rust feed
inputs:
configFile: $(CargoConfigPath)
# Workaround issue in public pipelines. Revert when root cause is fixed:
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cmake build Allfails in fork PR validation because cargo cannot read the Cargo index.CargoAuthenticate@0authenticates withSYSTEM_ACCESSTOKEN, which Azure DevOps does not deliver to fork builds; the task still reports success but writes the anonymous identity, so the failure only surfaces later as a 401/TF400813 from the feed.Both fixes are ported from
azure-sdk-for-rust.Changes
config.toml.templateat the project-scopedazure-sdk-for-rust-public~force-authfeedNuGetAuthenticate@1beforeCargoAuthenticate@0and pass itsVSS_NUGET_ACCESSTOKENin asSYSTEM_ACCESSTOKENSplit out of #7214, where this was validated as build 6688949:
cmake build All27/27, and CFSClean compliant on every job.