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

Documentation recommendations for setting up sources (w/ or w/o auth) for projects that run on CI #5881

Closed
rrelyea opened this issue Sep 12, 2017 · 6 comments
Labels
Area:Authentication Priority:2 Issues for the current backlog. Type:Docs
Milestone

Comments

@rrelyea
Copy link
Contributor

rrelyea commented Sep 12, 2017

Private NuGet feed:
Don’t you just put a nuget.config file in the project/solution? I see a bunch of questions on authenticating private nuget feeds. I’m assuming we could use buildargs to pass in.
https://www.google.com/search?q=private+nuget+server+authentication&rlz=1C1CHZL_enUS744US744&oq=private+nuget+feed
http://blog.fermium.io/nuget-server-with-basic-authentication/
https://blog.myget.org/post/2012/12/12/nuget-package-restore-from-a-secured-feed.html

Where do developers learn how to customize a private nuget feed? Is there VS tooling? Or, just docs?
I’m also trying to understand how this worked locally and failed in the build environment?

Start of docs:

The recommendation is generally to put a nuget.config at the solution level (or higher up the drive).
There is no tooling to create that, just docs.

And we probably should create something more streamlined in the docs to cover this…

From https://docs.microsoft.com/en-us/nuget/consume-packages/configuring-nuget-behavior:

Project-specific NuGet.Config files located in any folder from the solution folder up to the drive root. These allow control over settings as they apply to a project or a group of projects.

Making your NuGet.config look something like this is recommended (clear, then define your source) as a start.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <packageSources>
       <clear /> <!-- ensure only the sources defined below are used -->
    </packageSources>
    <disabledPackageSources>
       <clear />
    </disabledPackageSources>
</configuration>

Then configure all of your sources. If there is an authenticated source, set username and password.

nuget sources add -name MySource -Source http://myNuGetSource -username Tom -password MyPassword -StorePasswordInClearText -configfile c:\nugetExample\nuget.config

(cleartextpassword will work with dotnet.exe restore or nuget.exe restore.)

NuGet.config will end up looking like:

Things to improve:

  1. Bootstrapping a nuget.config
  2. ClearText password only on dotnet core
  3. Docs for this general guidance
@nkolev92
Copy link
Member

//cc
@karann-msft @anangaur

@brunobertechini
Copy link

Just my 5 cents. The dotnet task build for VSTS should have an option to store user/pass encrypted or use the build account to authenticate.

From MS Docs about nuget+vsts feeds:

We strongly recommend not checking your PAT into source control; anyone with access to your PAT can interact with VSTS as you.

I believe its a huge security risk put your PAT into nuget.config (into source control)

@a-vishar
Copy link

a-vishar commented Mar 6, 2018

Am I correct in my understanding here that my options for CI in VSTS to another VSTS authenticated feed:

  1. Store User/Password in NuGet.config/VSTS
  2. Store PAT in NuGet.Config/VSTS

Hosted build agents don't have PAT which means that the only option for those using hosted agents would be to store and manage their User/Password in either the config file or in VSTS?

Is there a task we can track for this being resolved either by the building user (for custom agents) or via some other permission mechanism when both the build agent and feed are in VSTS but in two different accounts?

Our current scenario is that we have a feed in account F that we want to access in our build in account B. We use a custom build agent and we do not wish to have the overhead of tracking PAT expiration or updating the username/password in VSTS. Given the build agent is running as a user authenticated in VSTS (account B) can that same auth not be used to access the feed (account F)?

@chris31389
Copy link

What about a prompt for login after a 401 is received? Similar to when you git push to VSTS for the first time.

@nkolev92
Copy link
Member

Related #6486.

We have done a lot of work to improve the dotnet.exe authentication scenarios in the above issue.

@aortiz-msft
Copy link
Contributor

Issue moved to NuGet/docs.microsoft.com-nuget #1974 via ZenHub

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area:Authentication Priority:2 Issues for the current backlog. Type:Docs
Projects
None yet
Development

No branches or pull requests

7 participants