我有一个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.
如果像 @brettsam 建议的那样将 Password
键更改为 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:
Password
值是直接从你的源获取的令牌吗?还是在本地机器上使用nuget.exe sources add|update
生成的? - brettsam