4

In my Azure DevOps organization i have 2 Project: Project 1: Some Tools Project 2: My Application

The Build Result from Project 1 is published to a feed in Project 1. In VS2019 I can use the nuget package from that feed in my application in Project 2. When I try to setup a pipeline for Project 2 I can not load the packages from project 1.

My Pipeline looks like:

steps:
- task: NuGetAuthenticate@0
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
  inputs:
    command: 'restore'
    restoreSolution: '**/*.sln'
    feedsToUse: 'select'
    vstsFeed: ***FEED_ID***
- task: VSBuild@1
  inputs:
    solution: '$(solution)'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

The nuget restore fails with the error:

##[error]The nuget command failed with exit code(1) and error(Unable to load the service index for source https://***organization***.pkgs.visualstudio.com/***FEED_ID***/_packaging/***PACKAGE_ID***/nuget/v3/index.json.
  Response status code does not indicate success: 404 (Not Found - VS800075: The project with id 'vstfs:///Classification/TeamProject/FEED_ID' does not exist, or you do not have permission to access it. (DevOps Activity ID: ...)).

Am I missing any configuration?

Georg H.
  • 83
  • 2
  • 5

2 Answers2

3

To use packages from a feed in Azure Pipelines, the appropriate build identity must have permission to your feed. By default, the Project Collection Build Service is a Contributor. If you've changed your builds to run at project scope, you'll need to add the project-level build identity as a Reader or Contributor, as desired. The project-level build identity is named as follows:

[Project name] Build Service ([Organization name]) (e.g. FabrikamFiber Build Service (codesharing-demo))

https://learn.microsoft.com/en-us/azure/devops/artifacts/feeds/feed-permissions?view=azure-devops#package-permissions-in-azure-pipelines

4c74356b41
  • 69,186
  • 6
  • 100
  • 141
2

Azure DevOps: Can not load nuget package from feed in Azure Pipeline

There is known issue about the project scope feed. Microsoft recently changed the default scope level for new feeds to Project instead of Organization.

So, you need to check if your feed is project scope feed or Organization scope feed. If it is Organization scope feed, you need to check if azure devops login account has permission to access the feed.

enter image description here

If the feed is project scope feed, you could try to use vstsFeed:<yourProjectName>/<yourFeedName> or add the project-level build identity as a Reader or Contributor.

Check this similar thread for some more details.

Hope this helps.

Leo Liu
  • 71,098
  • 10
  • 114
  • 135
  • 4
    Thanks for your comment. It finaly worked but I also had to add the Build User to the Project. Giving permissions only on the feed was not enough. – Georg H. Jan 08 '20 at 19:30
  • Which build user to which project? – James Law May 13 '20 at 15:44
  • 4
    @JamesLaw each project you have setup under your organization has it's own Build User account. So if you have an artifact under the Project Vanilla that Project Chocolate is trying to consume in one of its builds, you would need to add the Chocolate Build Service as a Build Administrator in Permissions under the Vanilla Project Settings. Thank you Georg H for the comment. That got me unstuck as well. – Joe de la Forms Aug 11 '20 at 18:56