Click here to Skip to main content
15,120,556 members
Articles / Hosted Services / Azure
Technical Blog
Posted 8 Jan 2015

Tagged as

Stats

7.6K views
3 bookmarked

Create Your Own Hosted NuGet Server in Azure

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
8 Jan 2015CPOL2 min read
How to create your own hosted NuGet Server in Azure

Some time ago, I wrote about how you could create your own local (private) NuGet server by simply putting your .nupkg files out on a server share to which you had access. But there’s a better way still!

As more than one of my readers commented, this isn’t optimal as not only does a proper NuGet server serve up packages, it also has indexing and searching optimizations to help it perform more efficiently when you’re looking for and pulling down packages from within Visual Studio.

With that in mind, I set out to see how easy it would be to create a NuGet server for myself in Azure.

The meat to doing this is pretty straightforward and present in the NuGet documentation. The interesting part is doing it in Azure, which is just a hop, skip, and a jump once you’ve got the site all set up in Visual Studio.

Come back when you’ve followed all those instructions.

Welcome back!

Now that you have your NuGet website set up within VS, it’s time to push it to Azure. It really is amazing what they’ve done within VS to make this as painless as possible. I was pretty dumbfounded at first.

Right click your Web Application project and click “Publish…”

image

Next, choose “Microsoft Azure Websites”.

image

Sign in to your Azure account, and then click New…

Pick something (available) for your site name and choose the Azure Subscription to which to tie it. You don’t need a database, so leave that as “No database”.

image

Click ‘Create’ and VS will talk to Azure and create the website for you, right on the spot.

image

Once that’s done, you’ll move to the next step in the wizard, with everything pre-filled for you (how nice!)

image

From here, you can hit ‘Publish’ and up it goes!

image

As an added bonus, since Azure Websites give everybody SSL certs, you get https access to your server as well.

And that’s IT. You have a fully-functional NuGet server that you can push to, pull from, and utilize in your build processes. If you’ve set an API key on it, then only those who know the key can push to it. If you want, you can lock down access to be able to pull using any of the myriad IIS Web Site security methods by simply editing the web.config that’s in the site and re-publishing it. For instance, at my workplace, we have done this and set the web.config to allow only IP addresses belonging to the public block assigned to our network. It’s secure enough.

The best part? Run this process again with a different website name and you’ve got a chocolatey server as well!

License

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

Share

About the Author

BC3Tech
Software Developer (Senior)
United States United States
I'm a Sr. Software Engineer in the Seattle area primarily focused on serverless technologies in the cloud. In my free time I enjoy hiking & other adventures with my family around the Puget Sound and the country! You can find out more about me at my homepage: http://bc3.tech/brandonh

Comments and Discussions

 
QuestionWhere are the nuget packages stored? Pin
gordonwatts9-Jan-15 10:23
Membergordonwatts9-Jan-15 10:23 
AnswerRe: Where are the nuget packages stored? Pin
BC3Tech9-Jan-15 10:25
MemberBC3Tech9-Jan-15 10:25 
Packages are stored on the server.
Azure has "free" versions of Websites. I have not dug in to the TOS to see if there are any limits imposed on the Free tier.

Storage is incredibly cheap anyway, and if you have more than a few MBs of personal nuget packages, you probably need to re-evaluate some things Wink | ;)

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.