4

I have created a build pipeline in Azure DevOps to build a .NET 8.0 application. The code resides in my Azure DevOps repository. I have selecteed the .NET Core template in classic editor to build the pipeline. My Pipeline stops at the 'Restore' task with an error :

error NU1301: Unable to load the service index for source
https://pkgs.dev.azure.com/myprojectname/_packaging/1199d650-e459-4ff6-85b8-91354ce28542/nuget/v3/index.json.

I have created an artifact feed in Azure DevOps which has all necessary NuGet packages installed. The build agent is a Microsoft hosted agent (windows OS) that tries to hit the URL and gets the error.

Can anyone help me fix this? Thank you

Tried adding other NuGet tasks like NuGet authentication, tool installer and NuGet restore but still facing the same error.

3
  • 2
    Does this answer your question? Nuget connection attempt failed "Unable to load the service index for source" Commented Feb 22, 2024 at 17:18
  • 1
    Check this question on stack. Also providing your pipeline code might be helpful Commented Feb 22, 2024 at 17:19
  • Hi @RohanRerkar, the error could be caused by the identity doesn't have permission on the target DevOps feed. You need to specify correct identity on the feed. Please follow the step in reply below for a check, let me know if you have any queries. Commented Mar 4, 2024 at 9:23

2 Answers 2

5

I have selected the .NET Core template in classic editor to build the pipeline. My Pipeline stops at the 'Restore' task with an error.

The error NU1301: Unable to load the service index for source is caused by the identity doesn't have permission on the target DevOps feed.

Go to the target feed -> Permissions tab, make sure the identity has granted the contributor(at least reader) permission.

enter image description here

The identity could be different based on your project configuration. Details below:

If you use nuget.config in the restore task, and configure user inside nuget.config, grant the permission for the account.

If you don't use nuget.config in the restore task, check the project settings -> Limit job authorization scope to current project for non-release pipelines:

  1. If the option is on, you need grant feed permission for project scoped identity({Project Name} Build Service ({Org Name})).

  2. If the option is off, which means it used collection scoped identity(Project Collection Build Service ({OrgName})), grant feed permission for this account.

You can check the official doc Scoped build identities for the details.

After you grant the permission for the correct identity, it should restore successfully.

In addition, as per the feed link in the error, it's organization level feed, it's not myprojectname but myorganizationname. If it's project level feed, the url has structure({org}/{project}) in url, like https://pkgs.dev.azure.com/{org}/{project}/_packaging/{feedname}/nuget/v3/index.json".

Sign up to request clarification or add additional context in comments.

Comments

0

What worked for me was doing all that wade zhou said

plus adding the Build service accounts under the Build Administrator permission group. enter image description here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.