[英]Can't provide NuGet package source credentials to Azure Function
我有一个依赖于私有包源的 Azure 函数。
我正在将nuget.config
文件复制到如下所示的应用服务:
<?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 等。
这是我在 Azure 功能门户的日志中看到的内容:
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.
如果我按照ClearTextPassword
建议将Password
密钥ClearTextPassword
为 ClearTextPassword,我现在会得到以下信息:
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 会假定该值已加密并会尝试对其进行解密。
例如,我在 VSTS 中创建了一个包提要,然后创建了一个个人访问令牌并使用了这个:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="MyPrivateFeed" value="https://brettsam.pkgs.visualstudio.com/_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>
<add key="MyPrivateFeed" value="https://brettsam.pkgs.visualstudio.com/_packaging/stackoverflow/nuget/v3/index.json" />
</packageSources></activePackageSource> key="ClearTextPassword" value="{PAT}" /></configuration><activePackageSource></MyPrivateFeed><add key="MyPrivateFeed" value="https://brettsam.pkgs.visualstudio.com/_packaging/stackoverflow/nuget/v3/index.json" /></packageSources><packageSourceCredentials><add key="Username" value="brettsam" /><add key="All" value="(Aggregate source)" /><?xml version="1.0" encoding="utf-8"?></configuration><add key="All" value="(Aggregate source)" /><add key="MyPrivateFeed" value="https://brettsam.pkgs.visualstudio.com/_packaging/stackoverflow/nuget/v3/index.json" /><add key="Username" value="brettsam" /><add key="MyPrivateFeed" value="https://brettsam.pkgs.visualstudio.com/_packaging/stackoverflow/nuget/v3/index.json" /</activePackageSource><add key="ClearTextPassword" value="{PAT}" /><add key="Username" value="brettsam" /></packageSources><add key="All" value="(Aggregate source)" /><packageSourceCredentials> <add key="All" value="(Aggregate source)" />
key="ClearTextPassword" value="{PAT}" /><packageSources, <add key="Username" value="brettsam
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.