Lutando
Lutando

Reputation: 5010

Authentication issues when pushing packages to internal Azure Dev Ops package feed

I am having trouble figuring out how to authenticate and push packages to the private Azure Dev Ops - Artifacts feed. I have a hunch that this is what I am looking for but not too sure how it is used exactly when using dotnet nuget push. The documentation only shows you how to use it when consuming packages and not when publishing packages to a private nuget feed (like Artifacts).

When using the DotNetCoreCLI@V2 task with the environment variable system.debug set to true (to increase log verbosity) I see that behind the scenes there is url that is retrieved as the feed url.

It looks like this within the build task

sr/bin/dotnet nuget push /home/vsts/work/1/s/src/{ProjectName}/bin/Release/{MyPackage}.0.4.5-alpha-1911.nupkg --source https://pkgs.dev.azure.com/{MyOrganisation}/_packaging/7064a25a-fa3a-7dc1-a8cb-9d05a01100ef/nuget/v3/index.json --api-key VSTS

The source url seems to be generated on each build as unique and I'm thinking that this is has something to do with my problem. The feed itself lists the feed url as https://pkgs.dev.azure.com/{MyOrganisation}/_packaging/{MyProject}/nuget/v3/index.json when go to feed options on Azure Dev Ops itself.

So nothing worked unfortunately. I was thinking that it would be great if I could use a private access token (PAT) to authenticate myself to the internal nuget feed.

I am figuring this out because I need to get this to work both in an outside of azure dev ops, so using the azure pipelines task is no good in my use case.

Upvotes: 0

Views: 512

Answers (1)

jefftrotman
jefftrotman

Reputation: 1104

I've been able to do this successfully using NuGet.exe (nuget push as opposed to dotnet nuget push).

On the Feed page, click the "Connect to Feed" button. There is a link there to "Download NuGet + Credential Provider". In the zip file, there will be a copy of NuGet.exe and CredentialProvider.VSS.exe. Extract them to the same folder.

When you run nuget push from that directory (copy the command syntax from the same page where it says "Push a package", substituting your .nupkg file name) the CredentialProvider prompts you for your credentials and handles the rest for you. The CredentialProvider.VSS.exe needs to be in the same directory as NuGet.exe

Upvotes: 0

Related Questions