Set Up Private NuGet Feeds with ProGet v4+

Georg Dangl by Georg Dangl in Continuous Integration Thursday, October 20, 2016

Thursday, October 20, 2016

Posted in DotNet

In an earlier post, I described how to get started with Inedos ProGet. It's a nice tool that lets you self host your own packages with a lot of supported repository types, like NuGet or npm. Lately, they've transitioned to version 4 with big changes to the UI so I thought I could post a small update, focusing on what has changed.

Install & Configure ProGet

Installation and initial configuration is nicely covered by their documentation, so I won’t go into much detail here. There was just one bit missing in the documentation that caused some troubles for me: When you’re using MS SQL Server, it’s possible that your default collation is different to the one ProGet will try to set during the database initialization, so make sure to create the ProGet database with SQL_Latin1_General_CP1_CI_AS collation and you’ll not run into issues, otherwise ProGet might fail to apply its database schema during installation.

To keep your feeds private, go to the settings page, then navigate to Manage Users & Tasks, select the Tasks and remove the Anonymous group from View & Download Packages. I've not yet discovered how to completely lock down v4 of ProGet, but this settings disables any access for non-authenticated users.

ProGet Task Authorization Menu

To access feeds, I'd recommend creating a regular user and then adding a permission for this user to View & Download Packages. This way, you'll have a login that works to privately access your repository feeds.

Enable NuGet Package Publishing with an Api Key

Usually, you can simply set an Api Key for NuGet package publishing in the feeds options according to the documentation. You do need to allow the Anonymous user the package publish right then, however. Since the built in task comes with quite a lot more privileges (like viewing the feed and pulling packages), it's best to create a new task that only has the Add Package privilege for publishing. Some NuGet versions, however, do have a quirk where before doing a push, they're making a GET request and run into authentication issues. For example, NuGet 3.3.0 does have this behavior while 3.4.4 does not. If there's some reason you can't upgrade the NuGet version you're using for publishing, you'll have to create a user for publishing and additionally grant him the View Feed rights and then use default NuGet authentication in addition to the api key when publishing packages.

To create the task, click on Customize Tasks in the tasks menu and select the Add Package and View Feed (if you're using a designated user for publishing) privilege under Feeds, then save the task and assign the Anonymous user to it (or your publisher!).

ProGet - Create Package Publisher Task

Tip: Use this command to locally save user credentials in NuGet: nuget source add -Name <NameOfTheStoredCredentials> -Source <YourNuGetFeedUrl> -User <Username> -Pass <Password>

If you want to continue reading, the old post covers a bit more about creating packages and deploying them via a Jenkins CI solution.


Share this post


comments powered by Disqus

About me

Hi, my name's George! I love coding and blogging about it. I focus on all things around .Net, Web Development and DevOps.

DanglIT

Need a partner for DevOps, Web Services or Software Development?

Contact me at [email protected], +49 (173) 56 45 689 or visit my professional page!

Dangl.Blog();
// Just 💗 Coding

Social Links