[英]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.