无法为Azure Function提供NuGet包源凭据

编程入门 行业动态 更新时间:2024-10-23 23:25:55
本文介绍了无法为Azure Function提供NuGet包源凭据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个Azure函数,该函数依赖于私有包提要.

I have an Azure function which has a dependency on a private package feed.

我正在将nuget.config文件复制到如下所示的应用程序服务中:

I am copying a nuget.config file to the app service which looks like this:

<?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> <add key="MyPackageFeed" value="<package feed path>" /> </packageSources> <packageSourceCredentials> <MyPackageFeed> <add key="Username" value="<first part of Hotmail address, before @ symbol>" /> <add key="Password" value="<newly generated access token for username>" /> </MyPackageFeed> </packageSourceCredentials> <activePackageSource> <add key="All" value="(Aggregate source)" /> </activePackageSource> </configuration>

注意:我使用Hotmail帐户电子邮件地址的第一部分,因为这是我用来验证其他地方(例如Visual Studio等)私人供稿的用户名.

Note: I use the first part of my Hotmail account email address as this is the username I use to authenticate to the private feed elsewhere - Visual Studio etc.

这是我在Azure功能门户的日志中看到的内容:

This is what I am seeing in the Logs in the Azure function portal:

2016-10-05T11:57:16.974 Restoring packages. 2016-10-05T11:57:16.974 Starting NuGet restore 2016-10-05T11:57:18.381 Restoring packages for D:\home\site\wwwroot\HttpTriggerSqlDb\project.json... 2016-10-05T11:57:19.322 Unable to load the service index for source <path to feed> 2016-10-05T11:57:19.322 The parameter is incorrect.

如果按照@brettsam的建议将Password键更改为ClearTextPassword,我现在将得到以下信息:

If I change the Password key to ClearTextPassword as suggested by @brettsam I now get the following:

2016-10-05T14:03:04.479 Please provide credentials for: <path to feed> 2016-10-05T14:03:05.097 Unable to load the service index for source <path to feed> 2016-10-05T14:03:05.097 Response status code does not indicate success: 401 (Unauthorized). 2016-10-05T14:03:05.142 UserName: Password:

推荐答案

尝试使用key="ClearTextPassword"(而不是key="Password").如果使用Password,nuget会假定该值已加密,并将尝试对其进行解密.

Try using key="ClearTextPassword" (instead of key="Password"). If you use Password, nuget assumes the value is encrypted and will try to decrypt it.

例如,我在VSTS中创建了一个包供稿,然后创建了一个个人访问令牌并使用了它:

For example, I created a package feed in VSTS, then created a personal access token and used this:

<?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> <add key="MyPrivateFeed" value="brettsam.pkgs.visualstudio/_packaging/stackoverflow/nuget/v3/index.json" /> </packageSources> <activePackageSource> <add key="All" value="(Aggregate source)" /> </activePackageSource> <packageSourceCredentials> <MyPrivateFeed> <add key="Username" value="brettsam" /> <add key="ClearTextPassword" value="{PAT}" /> </MyPrivateFeed> </packageSourceCredentials> </configuration>

更多推荐

无法为Azure Function提供NuGet包源凭据

本文发布于:2023-11-02 14:56:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1552699.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:凭据   Azure   Function   NuGet

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!