This is a very old post. But, in case, someone is still facing the problem and the above solutions have not worked like me then please follow as below.
Step One:
- Select project hosting the feed
- Select Project settings
- Select Permissions
- Select groups tab
- Select Contributors
- Select Members tab
- Click Add
- Select [Name of the project Consuming the Feed] Build Services ([Organization Name]) ex: FeedConsumer Build Services (xyz)
- Click Save
Step Two:
- Select project hosting the feed
- Select Artifacts
- Select your feed.
- Select Feed Settings
- Select Permissions
- Click Add Users/Groups button
- Select [Name of the project Consuming the Feed] Build Services ([Organization Name]) ex: FeedConsumer Build Services (xyz)
- Select the role as a contributor
- Click Save
Step Four:
Add nuGet.config file to the consumer project's root path where there is a .csproj or .sln file.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="[Feed Name]" value="https://pkgs.dev.azure.com/[Company Name]/[Project Name]/_packaging/[Feed Name]/nuget/v3/index.json" />
</packageSources>
</configuration>
Follow these steps to get the above xml
- Select project hosting the feed
- Select Artifacts
- Select the required feed
- Click Connect to Feed
- Select NuGet.exe
- It should be there in Project Setup
This should allow you to use the feed in one project to another project without giving you an unauthorized error. Happy Coding!!
Reference: https://learn.microsoft.com/en-us/azure/devops/artifacts/how-to/project-scoped-feeds-pipeline-project-permissions?view=azure-devops