I was getting an error in my Nuget Restore task logs that looked something like this
D:\a\1\s\Organization.Api.Public\Organization.Api.Public.csproj : error NU1301: Unable to load the service index for source https://pkgs.dev.azure.com/myotherorganization/_packaging/MyOtherOrgsNuGetFeed/nuget/v3/index.json.
My yaml for the Nuget Restore task has an externalFeedCredentials input with the name of my service connection that I created in my Devops project.
For authentication, I provided a Personal Access Token. I set my token to have a long life but access to the feed via my service connection that uses it was no longer working.
I created a new personal access token and associated it with the service connection that I was using in my yaml and that solved the problem. However, I still don’t know why it would have stopped before the original token’s expiration date.
Then, in order to give a nugetRestore task access to a feed, or possibly a test task, you can add the following inputs
feedsToUse: 'config'
nugetConfigPath: 'nuget.config'
externalFeedCredentials: 'MyOrgsNugetFeed'
includeNuGetOrg: true