VSTS Nuget还原凭据

时间:2018-04-03 06:14:33

标签: authentication build nuget azure-devops

我们正在使用需要身份验证的nuget包,并且当我们尝试通过VSTS构建构建项目时遇到问题。我们可以从经过身份验证的浏览器以及Visual Studio中提取外部nuget包。该项目在本地构建,没有任何问题。但是,当运行VSTS版本时,即使我们认为我们已经正确设置,我们也会收到401未经授权的混乱。

设置

  1. Image of nuget task
  2. Image of authentication for nuget feed
  3. Image of personal access token that is used
  4. 构建日志

    部分日志显示已选择并应用身份验证:

    2018-03-30T19:38:43.2917713Z Saving NuGet.config to a temporary config file.
    2018-03-30T19:38:43.3113980Z Using authentication information for the following URI: https://microsoft.pkgs.visualstudio.com/_packaging/MEE.Privacy/nuget/v3/index.json
    2018-03-30T19:38:43.3123672Z [command]D:\a\_tool\NuGet\4.1.0\x64\nuget.exe sources Remove -NonInteractive -Name Privacy -ConfigFile D:\a\4\Nuget\tempNuGet_5609.config
    2018-03-30T19:38:45.5301476Z Package source with Name: Privacy removed successfully.
    2018-03-30T19:38:45.5348241Z [command]D:\a\_tool\NuGet\4.1.0\x64\nuget.exe sources Add -NonInteractive -Name Privacy -Source https://microsoft.pkgs.visualstudio.com/_packaging/MEE.Privacy/nuget/v3/index.json -ConfigFile D:\a\4\Nuget\tempNuGet_5609.config -Username ******** -Password ********
    2018-03-30T19:38:46.0254022Z Package Source with Name: Privacy added successfully.
    2018-03-30T19:38:46.0295574Z [command]D:\a\_tool\NuGet\4.1.0\x64\nuget.exe restore D:\a\4\s\msc\dev\Msc.Privacy\Msc.Privacy.sln -Verbosity Detailed -NonInteractive -ConfigFile D:\a\4\Nuget\tempNuGet_5609.config
    


    我们在尝试查找nuget包时收到错误:

    The nuget command failed with exit code(1) and error(Errors in packages.config projects
    Unable to find version '1.1.18087.3' of package 'Microsoft.PrivacyServices.CommandFeed.Client'.
    C:\Users\VssAdministrator\.nuget\packages\: Package 'Microsoft.PrivacyServices.CommandFeed.Client.1.1.18087.3' is not found on source 'C:\Users\VssAdministrator\.nuget\packages\'.
    D:\a\4\Nuget\..\..\_Packages: Package 'Microsoft.PrivacyServices.CommandFeed.Client.1.1.18087.3' is not found on source 'D:\a\4\Nuget\..\..\_Packages'.
    https://api.nuget.org/v3/index.json: Package 'Microsoft.PrivacyServices.CommandFeed.Client.1.1.18087.3' is not found on source 'https://api.nuget.org/v3/index.json'.
    https://microsoft.pkgs.visualstudio.com/_packaging/MEE.Privacy/nuget/v3/index.json: Unable to load the service index for source https://microsoft.pkgs.visualstudio.com/_packaging/MEE.Privacy/nuget/v3/index.json.
    Response status code does not indicate success: 401 (Unauthorized).
    

    问题

    关于我们可能遗失的任何想法?

1 个答案:

答案 0 :(得分:1)

事实证明我们的个人访问令牌设置不正确。创建令牌时,我们没有选择正确的帐户。为了解决我们的问题,我们使用“所有可访问的[Microsoft]帐户”而不是“myuser1”创建了一个新令牌。

Image of personal access token creation