Click here to Skip to main content
15,390,740 members
Articles / Hosted Services / Azure
Posted 5 Feb 2015


28 bookmarked

Create Your Own Private NuGet Server in Windows Azure

Rate me:
Please Sign up or sign in to vote.
4.88/5 (21 votes)
5 Feb 2015CPOL6 min read
As an introduction to Windows Azure, this article will guide you step by step to create your own private NuGet server in Windows Azure.


Whether you are part of a large development team or working alone on your own side project, you'll probably want to re-use code across multiple projects.

One neat way of doing it, is to create packages, to store them in a repository and to reference them whenever needed. NuGet packages also allow you to have multiple versions of a same package and to specify any eventual dependencies. If you regularly use NuGet Package Manager from Visual Studio, then you are already very familiar with the concept.

This article will show you how you can create your own private NuGet server and how to host it in Windows Azure.


Do I need to mention you need Visual Studio? Maybe not, but I've just done it! Any recent edition should do (screenshots for this article are taken from Visual Studio 2013).

And obviously, you'll also need a valid subscription to Windows Azure. If you don't have one yet, you can sign up for a free 30-day trial here.

Create a New NuGet Server

Open Visual Studio. Go to File > New > Project... to create a new project. From the templates, select ASP.NET Empty Web Application, as follows:

new empty web application

The Solution Explorer should show an empty solution, as follows:

Empty solution

Now, we'll use the official NuGet repository to add NuGet.Server to our project. Right-click on References and select Manage NuGet Packages... . Search for NuGet.Server and click Install.

select and install nuget server

Now, the solution should look like this:

solution with nuget server

Press F6 and ensure the solution builds successfully.

We're almost ready. There's just one more thing to do before we can run and deploy our code, which is to review our configuration. Open up web.config and review the following settings.

        Determines if an Api Key is required to push\delete packages from the server.
<add key="requireApiKey" value="true"/>
        Set the value here to allow people to push/delete packages from the server.
        NOTE: This is a shared key (password) for all users.
<add key="apiKey" value="Xx5TJbXBe9jEvAfGxV7x"/>
        Change the path to the packages folder. Default is ~/Packages.
        This can be a virtual or physical path.
<add key="packagesPath" value=""/>

To ensure only authorized users will be able to add and delete packages, set requireApiKey to true and set apiKey to the specific key you want to use. (Please make sure to use a different key than the one given in this example). Leave packagesPath to its default value.

Press F5 to run the server. You should see the following home page:

you are running nuget server

Now that we've got a NuGet server up and running locally, let's deploy it to Windows Azure.

Deploy to Windows Azure

The integration with Windows Azure from Visual Studio is excellent and you can create your new website and deploy to it directly from Visual Studio. In the Solution Explorer, right click on NuGetServer project and click on Publish...

right click and publish

From the Profile section, select Microsoft Azure Websites.

select azure and publish

Click sign-in and authenticate with the email address used when you signed up for Windows Azure.

sign in

Now that you are signed in, click New... to create a new website:

signed in

Chose a site name that has not be taken already. I'm going to use code-project-nugetserver for the remainder of this article. The Nuget server will then be available at: (of course, you should use a different name as a reader may have already used it).

Unless you have multiple subscriptions, keep the default one. Chose a region that will be close to your users in order to improve performance. There is no need for a database for this project.

create website in azure

Now, click Create to create the website in Azure. Once it's created, you'll be shown the final screen before publication. It contains connection details, such as the address of the site, the username and the password. All fields should be correctly pre-populated and you can click Validate Connection to ensure the details are correct.

When you are ready, click Publish to publish the NuGet server to the website.

validate connection and publish

Now go to (remember it was recommended you chose a different name, so the first part of the URL should be different for you) to ensure the server is up and running. You should see something like:

running live

Congratulations, you've got your NuGet server up and running!

Publish your First Package

Download NuGet.exe from (or check for the latest version) and make sure it's in your path so you can run it from the command line. Indeed, NuGet.exe is a command line tool which allows you to create and to publish packages. For the purpose of this article, I've attached a sample package (Sample.Package., and if you want to read more about how to create NuGet packages, there is an excellent documentation on

You are now ready to publish you first package. From the command line, run:

nuget push Sample.Package. -s Xx5TJbXBe9jEvAfGxV7x


You can double check your packages has been successfully published by going to Ensure Sample.Package. is listed in the page:


Download Your Own Packages from Visual Studio

Now that you have your own NuGet Server, you can configure Visual Studio Package Manager to serve your own packages. In Visual Studio, go to Tools > Options > NuGet Package Manager > Packages Sources. Click on the + sign (top right corner) to add a new source. Give it a name in the Name field, for instance My Packages and set the Source to

add nuget source to visual studio

Now, you can add your own packages to your projects. For a given project, right-click on References and select Manage NuGet Packages... . On the left hand-side, select My Packages, and Sample.Package. should be listed:

download package

You now have a mature development environment where you can publish packages for re-use across multiple projects.

Points of Interest

In this article, I've covered in detail how to create your own private NuGet server and how to publish it to Windows Azure. This is quite simple to set up and your server should be running from the cloud in less than 20 minutes.

Bundle up your code in packages and publish them to share with your development team or for yourself to re-use in future projects. You can also use NuGet packages for deployment purpose: I will cover how to deploy code with Octopus Deploy in a future article.

One of the great advantages of Windows Azure is scalability and I will cover in detail in a separate article how you can set up your website to automatically scale up or down based on your server workload.

Gotcha: If you don't want to store the NuGet packages in the default folder, make sure you specify a relative path. Your server is running in IIS alongside a number of other websites. The security model in Azure makes sure that each website runs in isolation and therefore has only got access to the root folder of the website.

Please let me know how you get on with your NuGet server. Do you use it at work? Or do you use it at home for a side project? Do you use it for deployments? Have you encounter any limitations or do you have any feature requests?

Thanks for your feedback and happy coding!


  • [05/02/2015]: First publication


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Alex Sanséau
Technical Lead
United Kingdom United Kingdom
Alex is an experienced .NET professional with strong technical skills and management
experience. Alex is specialised in Microsoft stack and web technology (C#, MVC, Azure, T-SQL, CSS, jQuery...) and he's passionate about software development best practices.

Comments and Discussions

QuestionList multiple version Pin
pankajtiwary27-Mar-17 18:50
Memberpankajtiwary27-Mar-17 18:50 
QuestionHost the server in IIS Pin
Carolina Faedo30-Jan-17 7:27
MemberCarolina Faedo30-Jan-17 7:27 
QuestionCan i secure it? Pin
imranforallah17-Jan-17 23:38
Memberimranforallah17-Jan-17 23:38 
QuestionProblem re-deploying the site - Updates to NUGet server break build. Pin
Randy Kreisel20-Dec-16 6:11
MemberRandy Kreisel20-Dec-16 6:11 
QuestionAre packages really persisted? Pin
Liero_7-Dec-15 22:35
MemberLiero_7-Dec-15 22:35 
QuestionDownload count Pin
walterhuang5-Nov-15 20:40
Memberwalterhuang5-Nov-15 20:40 
GeneralGreat Article Pin
Tim Corey18-Jun-15 7:31
professionalTim Corey18-Jun-15 7:31 
GeneralRe: Great Article Pin
Alex Sanséau23-Jun-15 5:16
MemberAlex Sanséau23-Jun-15 5:16 
QuestionSecurity? Pin
Member 431598211-Jun-15 18:35
MemberMember 431598211-Jun-15 18:35 
AnswerRe: Security? Pin
Tim Corey18-Jun-15 7:29
professionalTim Corey18-Jun-15 7:29 
GeneralRe: Security? Pin
Alex Sanséau23-Jun-15 5:10
MemberAlex Sanséau23-Jun-15 5:10 
AnswerRe: Security? Pin
Alex Sanséau23-Jun-15 5:09
MemberAlex Sanséau23-Jun-15 5:09 
QuestionDeploying to azure and using these packages Pin
Stuart Dobson24-May-15 12:55
MemberStuart Dobson24-May-15 12:55 
AnswerRe: Deploying to azure and using these packages Pin
Alex Sanséau23-Jun-15 5:20
MemberAlex Sanséau23-Jun-15 5:20 
QuestionWhere is the downloadable sample? Pin
emmag30-Apr-15 18:23
professionalemmag30-Apr-15 18:23 
AnswerRe: Where is the downloadable sample? Pin
Alex Sanséau23-Jun-15 5:32
MemberAlex Sanséau23-Jun-15 5:32 
GeneralRe: Where is the downloadable sample? Pin
Member 1190483712-Aug-15 7:47
MemberMember 1190483712-Aug-15 7:47 
GeneralRe: Where is the downloadable sample? Pin
ZeProgFactory25-Jun-17 23:02
MemberZeProgFactory25-Jun-17 23:02 
QuestionGrowing interest in private NuGet servers Pin
Derek E. Weeks11-Feb-15 3:13
MemberDerek E. Weeks11-Feb-15 3:13 
SuggestionDon't use this if you need to host hundreds of packages Pin
Xavier Decoster8-Feb-15 6:43
MemberXavier Decoster8-Feb-15 6:43 
GeneralRe: Don't use this if you need to host hundreds of packages Pin
Alex Sanséau9-Feb-15 21:51
MemberAlex Sanséau9-Feb-15 21:51 
GeneralRe: Don't use this if you need to host hundreds of packages Pin
Eniep Yrekcaz15-Jul-15 17:46
MemberEniep Yrekcaz15-Jul-15 17:46 
GeneralMy vote of 5 Pin
Gaston Verelst6-Feb-15 9:35
MemberGaston Verelst6-Feb-15 9:35 
GeneralRe: My vote of 5 Pin
Alex Sanséau7-Feb-15 0:19
MemberAlex Sanséau7-Feb-15 0:19 
QuestionHow about database? Pin
Grzegorz Mrozik5-Feb-15 20:16
MemberGrzegorz Mrozik5-Feb-15 20:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.