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.
The
error NU1301: Unable to load the service index for sourceis caused by theidentitydoesn't have permission on the target DevOps feed.Go to the target feed ->
Permissionstab, make sure the identity has granted thecontributor(at leastreader) permission.The
identitycould 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:If the option is on, you need grant feed permission for project scoped identity(
{Project Name} Build Service ({Org Name})).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
correctidentity, it should restore successfully.In addition, as per the feed link in the error, it's
organization levelfeed, it's notmyprojectnamebutmyorganizationname. If it's project level feed, the url has structure({org}/{project}) in url, likehttps://pkgs.dev.azure.com/{org}/{project}/_packaging/{feedname}/nuget/v3/index.json".