Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set VSS_NUGET_EXTERNAL_FEED_ENDPOINTS correctly #53

Closed
doggy8088 opened this issue Jan 14, 2019 · 6 comments
Closed

How to set VSS_NUGET_EXTERNAL_FEED_ENDPOINTS correctly #53

doggy8088 opened this issue Jan 14, 2019 · 6 comments

Comments

@doggy8088
Copy link

I'm trying to set VSS_NUGET_EXTERNAL_FEED_ENDPOINTS environment variable but it looks like no effect.

Here are the steps to reproduce my problem.

Machine A:

  1. Install NuGet.exe and CredentialProvider.VSS.exe

    choco install nuget.commandline nuget-credentialprovider-vss -y
  2. Create new nuget.config file

    dotnet new nuget
  3. Add my Azure Artifacts NuGet feed

    nuget sources add -Name {YourOrg} -Source https://{YourOrg}.pkgs.visualstudio.com/_packaging/{YourProject}/nuget/v3/index.json
  4. Try pass the authenticate

    nuget list
  5. Generate PAT by the following command. Copy the "Password" property's value as PAT.

    CredentialProvider.VSS.exe -U https://{YourOrg}.pkgs.visualstudio.com/_packaging/{YourProject}/nuget/v3/index.json

Machine B:

  1. Install NuGet.exe and CredentialProvider.VSS.exe

    choco install nuget.commandline nuget-credentialprovider-vss -y
  2. Create new nuget.config file

    dotnet new nuget
  3. Add my Azure Artifacts NuGet feed

    nuget sources add -Name {YourOrg} -Source https://{YourOrg}.pkgs.visualstudio.com/_packaging/{YourProject}/nuget/v3/index.json
  4. Setup VSS_NUGET_EXTERNAL_FEED_ENDPOINTS environment variable. The [PAT] is what I generated at Machine A.

    set VSS_NUGET_EXTERNAL_FEED_ENDPOINTS={"endpointCredentials": [{"endpoint":"https://{YourOrg}.pkgs.visualstudio.com/_packaging/{YourProject}/nuget/v3/index.json", "username":"VssSessionToken", "password":"[PAT]"}]}
  5. Try pass the authenticate but this doesn't read VSS_NUGET_EXTERNAL_FEED_ENDPOINTS environment variable!

    nuget list

I expected the pass authentication because I already set correct VSS_NUGET_EXTERNAL_FEED_ENDPOINTS environment variable! Am I do something wrong?

@doggy8088
Copy link
Author

doggy8088 commented Jan 15, 2019

I was misunderstanding the "PAT" means. This are wrong steps.

Also, I realized one thing: This VSS_NUGET_EXTERNAL_FEED_ENDPOINTS environment variable doesn't apply NuGet.exe tool. Only for dotnet tool (.NET CLI).

@satbai
Copy link
Contributor

satbai commented Jan 15, 2019

Please also note that CredentialProvider.VSS.exe is a different cred provider. To use this one you can use one of these scripts to install it to the correct location on your machine. Then you should be able to use the VSS_NUGET_EXTERNAL_FEED_ENDPOINTS environment variable. You can create a PAT in your Azure DevOps account https://dev.azure.com//_usersSettings/tokens

@doggy8088
Copy link
Author

I wrote a very detailed tutorial about this: https://blog.miniasp.com/post/2019/01/16/Setup-Azure-Artifacts-NuGet-Feeds.aspx

@csurfleet
Copy link

@doggy8088 Any chance of a version in English? I've tried translation tools but not getting anything useful.

I've tried all this in many permutations over weeks now and I still get errors CURLing from the container to the feed - "The user '' is not authorized to view this resource"

@doggy8088
Copy link
Author

@csurfleet Please open PowerShell and run the following command:

$env:VSS_NUGET_EXTERNAL_FEED_ENDPOINTS = '{"endpointCredentials": [{"endpoint":"https://{YourOrg}.pkgs.visualstudio.com/_packaging/{YourProject}/nuget/v3/index.json", "password":"[PAT]"}]}'
dotnet restore

Then you can pass the authentication.

@rhumborl
Copy link

rhumborl commented Dec 3, 2021

For anyone checking this issue and wanting to translate https://blog.miniasp.com/post/2019/01/16/Setup-Azure-Artifacts-NuGet-Feeds.aspx, I did it in Chrome, but needed to manually set the source language to "Chinese (simplified)" as it was not automatically detected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants