3
votes

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?

2
How about the issue? Does the answer below resolved your question, If yes, you could accept it as an answer, so it could help other community members who get the same issues and we could archive this thread, thanks. If not, please let us know if you would like further assistance.Leo Liu-MSFT

2 Answers

2
votes

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.

3
votes

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://docs.microsoft.com/en-us/azure/devops/artifacts/feeds/feed-permissions?view=azure-devops#package-permissions-in-azure-pipelines