12

How can I access nuget packages hosted in private nuget server in Azure Functions?. Is there any way I can specify my private nuget server info?

Thanks!

Krishh
  • 4,111
  • 5
  • 42
  • 52

2 Answers2

19

Krishh,

This is possible using a nuget.config file as you normally would:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="MyPrivateFeed" value="http://myhost/myfeed" />
    ... other feeds ...
  </packageSources>
  <activePackageSource>
    <add key="All" value="(Aggregate source)" />
  </activePackageSource>
</configuration>

Using Kudu, or another deployment method outlined here, copy that file to either the function folder or wwwroot (that would apply to all functions) and your config will be used.

Community
  • 1
  • 1
Fabio Cavalcante
  • 12,328
  • 3
  • 35
  • 43
  • 1
    Krishh, the latest deployment contains this update. Since there was a minor version bump with this deployment, the changes will not be automatically applied to existing Function Apps, so you may need to change your FUNCTIONS_EXTENSION_VERSION app setting to ~0.2 (you can find the application settings under Function app settins > Go to app service settings > Application Settings) – Fabio Cavalcante Apr 26 '16 at 16:26
  • 1
    per https://www.visualstudio.com/en-us/docs/package/get-started/nuget/auth#net-core using a private NuGet feed looks to be impossible (requires local machine changes?), or at least unwise (storing a PAT in plaintext). Is this something that will get better support soon? – JoeBrockhaus Jul 13 '16 at 06:59
  • I would also like to know the answer to Joe's question. We have a private NuGet feed hosted by VSTS, and I would like to use packages from that in an Azure Function App, but I want (need) to do it securely (not storing keys in source control) and in a scaleable/manageable way (not needing to make changes manually in every deployment). Can this be accomplished? – Josh Nov 03 '16 at 01:33
  • @FabioCavalcante any update on the deployment of this? – Jasper Dec 29 '16 at 20:53
  • @FabioCavalcante any updates on this? I tried what's mentioned but can't get it to work – RPM1984 Feb 28 '17 at 06:37
  • @RPM1984 the deployment comment reflected a pre-release state. This should work on the current runtime as-is. What issues are you seeing? – Fabio Cavalcante Feb 28 '17 at 17:36
  • @FabioCavalcante i got it working. _None_ of my Nuget packages were working. I had an issue in my NuGet.config where i was referencing SeriLog 2.4.0.0, needed to be 2.4.0. When i updated that, it then reinstalled _all_ the packages, including my private ones. Thanks! – RPM1984 Feb 28 '17 at 22:18
  • I just tried creating nuget.config in the site/wwwroot, and that hasn't worked :( – Ian Grainger Feb 20 '19 at 12:56
3

There are several posts related to your question if we assume that your private nuget package can be deployed as a simple .Net library:

Community
  • 1
  • 1
Thomas
  • 24,234
  • 6
  • 81
  • 125
  • I was wondering if there was anyway when restoring nuget packages we could specify the private nuget server info?. @Thomas – Krishh Apr 19 '16 at 22:58
  • If your server is accessible, it could be. ask a new quesiotn to see if there is any option to specify the nuget source packages – Thomas Apr 19 '16 at 23:13