简体   繁体   中英

How do I provide private NuGet feed credentials to an Azure Function?

I am trying to create an Azure function which has dependencies on NuGet packages hosted in a private NuGet feed.

This question describes using a nuget.config file which is uploaded to the app service which hosts the function - my nuget.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="MyPrivateFeed" value="https://<url to feed>" />
  </packageSources>
  <activePackageSource>
    <add key="All" value="(Aggregate source)" />
  </activePackageSource>
</configuration>

My function is using this config file as expected, but it doesn't have the credentials it needs. The Azure function portal shows the following:

2016-10-04T09:00:55.442 Starting NuGet restore
2016-10-04T09:00:56.926 Restoring packages for D:\home\site\wwwroot\HttpTriggerSqlDb\project.json...
2016-10-04T09:00:58.267 Please provide credentials for: https://<url to feed>
2016-10-04T09:00:58.515 Unable to load the service index for source https://<url to feed>.
2016-10-04T09:00:58.515 Response status code does not indicate success: 401 (Unauthorized).

How do I provide credentials for the private feed?

您应该可以直接在nuget配置文件中设置凭据: https ://docs.nuget.org/ndocs/schema/nuget.config-file.md#packagesourcecredentials。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM