title: TFS ONPREMISE - Package Feed - BuildAgent do not restore Nuget Packages : 403
body: <p>I try to use TFS onpremise with Package Feed as NugetServer for my custom packages.</p>
  
  <p>Here a dump of all my configuration settings:</p>
  
  <ul>
  <li>TFS Server : Version 16.122.27409.2</li>
  <li>The Task Nuget set on Push work fine.</li>
  <li>The agentbuild user account can access to feed url (<a href="https://xxx/team/_packaging/myfeedPackage/nuget/v3/index.json" rel="nofollow noreferrer">https://xxx/team/_packaging/myfeedPackage/nuget/v3/index.json</a> and <a href="https://XXXXX/XXXX/_packaging/GUID/nuget/v3/index.json" rel="nofollow noreferrer">https://XXXXX/XXXX/_packaging/GUID/nuget/v3/index.json</a>) in a browser and it can retrive the full package list.</li>
  <li>My agentbuild account is set as Owner in the feed setting</li>
  <li>My agentbuild account is Project Collection Build Service Account and Project Collection Admin</li>
  <li>Build using only nuget.org work fine.</li>
  <li>The server Auth hasn't basicauthentification actived</li>
  <li>The buildagent useraccount is in the Users list of Package Mangement</li>
  <li>I use basic configuration to consume the feed; See below:
  <a href="https://i.stack.imgur.com/TqREF.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TqREF.jpg" alt="nugettask"></a></li>
  <li>Here my nuget.config
  <a href="https://i.stack.imgur.com/qm7vP.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qm7vP.jpg" alt="nugetconfig"></a>
  Finally my error....
  
  <blockquote>
    <p>2019-04-17T12:14:15.8577145Z ##[section]Starting: NuGet restore ***.sln
    2019-04-17T12:14:15.8890019Z ==============================================================================
    2019-04-17T12:14:15.8890019Z Task         : NuGet
    2019-04-17T12:14:15.8890019Z Description  : Restore, pack, or push NuGet packages, or run a NuGet command. Supports NuGet.org and authenticated feeds like Package Management and MyGet.
    2019-04-17T12:14:15.8890019Z Version      : 2.0.7
    2019-04-17T12:14:15.8890019Z Author       : Microsoft Corporation
    2019-04-17T12:14:15.8890019Z Help         : <a href="https://go.microsoft.com/fwlink/?LinkID=613747" rel="nofollow noreferrer">More Information</a>
    2019-04-17T12:14:15.8890019Z ==============================================================================
    2019-04-17T12:14:17.0140203Z Found tool in cache: NuGet 4.0.0 x64
    2019-04-17T12:14:17.0140203Z Found tool in cache: NuGet 4.0.0 x64
    2019-04-17T12:14:17.0296711Z Resolved from tool cache: 4.0.0
    2019-04-17T12:14:17.0296711Z Using version: 4.0.0
    2019-04-17T12:14:17.0296711Z Found tool in cache: NuGet 4.0.0 x64
    2019-04-17T12:14:17.0452724Z [command]C:\Windows\system32\chcp.com 65001
    2019-04-17T12:14:17.0609004Z Active code page: 65001
    2019-04-17T12:14:17.4514520Z Detected NuGet version 4.0.0.2283 / 4.0.0
    2019-04-17T12:14:17.4514520Z SYSTEMVSSCONNECTION exists true
    2019-04-17T12:14:17.7483273Z Saving NuGet.config to a temporary config file.
    2019-04-17T12:14:17.7639506Z [command]D:\BuildAgents\Dev-AgentCtrl-05_work_tool\NuGet\4.0.0\x64\nuget.exe sources Add -NonInteractive -Name a3fed2a3-b497-407d-a1b5-bb8f7dad0e33 -Source <a href="https://XXXXX/XXXX/_packaging/a3fed2a3-b497-407d-a1b5-bb8f7dad0e33/nuget/v3/index.json" rel="nofollow noreferrer">https://XXXXX/XXXX/_packaging/a3fed2a3-b497-407d-a1b5-bb8f7dad0e33/nuget/v3/index.json</a> -ConfigFile D:\BuildAgents\Dev-AgentCtrl-05_work\48\Nuget\tempNuGet_59927.config
    2019-04-17T12:14:18.5765194Z Package Source with Name: a3fed2a3-b497-407d-a1b5-bb8f7dad0e33 added successfully.
    2019-04-17T12:14:18.5928735Z [command]D:\BuildAgents\Dev-AgentCtrl-05_work_tool\NuGet\4.0.0\x64\nuget.exe sources Add -NonInteractive -Name NuGetOrg -Source <a href="https://api.nuget.org/v3/index.json" rel="nofollow noreferrer">https://api.nuget.org/v3/index.json</a> -ConfigFile D:\BuildAgents\Dev-AgentCtrl-05_work\48\Nuget\tempNuGet_59927.config
    2019-04-17T12:14:19.3420745Z Package Source with Name: NuGetOrg added successfully.
    2019-04-17T12:14:19.3420745Z Saving NuGet.config to a temporary config file.
    2019-04-17T12:14:19.3576993Z [command]D:\BuildAgents\Dev-AgentCtrl-05_work_tool\NuGet\4.0.0\x64\nuget.exe restore D:\BuildAgents\Dev-AgentCtrl-05_work\48\s\MySuperPackage.Server.sln -Verbosity Detailed -NonInteractive -ConfigFile D:\BuildAgents\Dev-AgentCtrl-05_work\48\Nuget\tempNuGet_59927.config
    2019-04-17T12:14:19.9202661Z NuGet Version: 4.0.0.2283
    2019-04-17T12:14:20.0295761Z MSBuild auto-detection: using msbuild version '15.9.21.664' from 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\bin'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild.
    2019-04-17T12:14:20.2014517Z MSBuild P2P timeout [ms]: 120000
    2019-04-17T12:14:20.2170764Z C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\bin\msbuild.exe /t:GenerateRestoreGraphFile /nologo /nr:false /p:RestoreUseCustomAfterTargets=true /p:BuildProjectReferences=false /v:q  /p:NuGetRestoreTargets="D:\BuildAgents\Dev-AgentCtrl-05_work_temp\NuGet-Scratch\jftfbyv1.wfk.targets" /p:RestoreTaskAssemblyFile="D:\BuildAgents\Dev-AgentCtrl-05_work_tool\NuGet\4.0.0\x64\nuget.exe" /p:RestoreGraphOutputPath="D:\BuildAgents\Dev-AgentCtrl-05_work_temp\NuGet-Scratch\toygjw1x.1vs.result" /p:ExcludeRestorePackageImports=true  /p:RestoreRecursive=False  /p:RestoreProjectFilterMode=exclusionlist /p:RestoreContinueOnError=WarnAndContinue  /p:RestoreGraphProjectInput="D:\BuildAgents\Dev-AgentCtrl-05_work\48\s\MySuperPackage.Server\MySuperPackage.Server.csproj;D:\BuildAgents\Dev-AgentCtrl-05_work\48\s\MySuperPackage.Server.Tests\MySuperPackage.Server.Tests.csproj;D:\BuildAgents\Dev-AgentCtrl-05_work\48\s\MySuperPackage.Annuaire.IntegrationTests\MySuperPackage.Annuaire.IntegrationTests.csproj;D:\BuildAgents\Dev-AgentCtrl-05_work\48\s\MySuperPackage.Server.Tools\MySuperPackage.Server.Tools.csproj;D:\BuildAgents\Dev-AgentCtrl-05_work\48\s\MySuperPackage.Permissions.IntegrationTests\MySuperPackage.Permissions.IntegrationTests.csproj;D:\BuildAgents\Dev-AgentCtrl-05_work\48\s\MySuperPackage.Mail.IntegrationTests\MySuperPackage.Mail.IntegrationTests.csproj;D:\BuildAgents\Dev-AgentCtrl-05_work\48\s\MySuperPackage.Server.Testing\MySuperPackage.Server.Testing.csproj;D:\BuildAgents\Dev-AgentCtrl-05_work\48\s\MySuperPackage.Server.Data\MySuperPackage.Server.Data.csproj;D:\BuildAgents\Dev-AgentCtrl-05_work\48\s\MySuperPackage.Server.Data.Tests\MySuperPackage.Server.Data.Tests.csproj;D:\BuildAgents\Dev-AgentCtrl-05_work\48\s\MySuperPackage.RH.IntegrationTests\MySuperPackage.RH.IntegrationTests.csproj;" "D:\BuildAgents\Dev-AgentCtrl-05_work_temp\NuGet-Scratch\jftfbyv1.wfk.targets"
    2019-04-17T12:14:22.1545783Z Restoring NuGet package MySuperPackage.Tools.Http.1.8.1.
    2019-04-17T12:14:22.1545783Z Restoring NuGet package MySuperPackage.Annuaire.Client.1.24.0-dev20190417-04.
    2019-04-17T12:14:22.2014526Z Missing C:\Users\P-TF18-S-1BuildDev1.nuget\packages\MySuperPackage.tools.http\1.8.1\MySuperPackage.tools.http.1.8.1.nupkg
    2019-04-17T12:14:22.2014526Z Missing C:\Users\P-TF18-S-1BuildDev1.nuget\packages\MySuperPackage.annuaire.client\1.24.0-dev20190417-04\MySuperPackage.annuaire.client.1.24.0-dev20190417-04.nupkg
    2019-04-17T12:14:22.6545739Z CredentialProvider.TeamBuild: "D:\BuildAgents\Dev-AgentCtrl-05_work_tasks\NuGetCommand_333b11bd-d341-40d9-afcf-b32d5ce6f23b\2.0.7\node_modules\nuget-task-common\NuGet\CredentialProvider\CredentialProvider.TeamBuild.exe" -uri <a href="https://XXXXX/XXXXXX/_packaging/a3fed2a3-b497-407d-a1b5-bb8f7dad0e33/nuget/v3/index.json" rel="nofollow noreferrer">https://XXXXX/XXXXXX/_packaging/a3fed2a3-b497-407d-a1b5-bb8f7dad0e33/nuget/v3/index.json</a> -nonInteractive -verbosity detailed
    2019-04-17T12:14:22.6545739Z CredentialProvider.TeamBuild: URI Prefixes:
    2019-04-17T12:14:22.6545739Z CredentialProvider.TeamBuild:     <a href="https://tfs.XXXXXX/XXXXX/" rel="nofollow noreferrer">https://tfs.XXXXXX/XXXXX/</a>
    2019-04-17T12:14:22.6545739Z CredentialProvider.TeamBuild: URI: <a href="https://tfs.XXXXXX/XXXXX/_packaging/a3fed2a3-b497-407d-a1b5-bb8f7dad0e33/nuget/v3/index.json" rel="nofollow noreferrer">https://tfs.XXXXXX/XXXXX/_packaging/a3fed2a3-b497-407d-a1b5-bb8f7dad0e33/nuget/v3/index.json</a>
    2019-04-17T12:14:22.6545739Z CredentialProvider.TeamBuild: Is retry: False
    2019-04-17T12:14:22.6545739Z CredentialProvider.TeamBuild: Matched prefix: <a href="https://tfs.XXXXXX/XXXXX/" rel="nofollow noreferrer">https://tfs.XXXXXX/XXXXX/</a>
    2019-04-17T12:14:23.4045752Z CredentialProvider.TeamBuild: "D:\BuildAgents\Dev-AgentCtrl-05_work_tasks\NuGetCommand_333b11bd-d341-40d9-afcf-b32d5ce6f23b\2.0.7\node_modules\nuget-task-common\NuGet\CredentialProvider\CredentialProvider.TeamBuild.exe" -uri <a href="https://tfs.XXXXXX/XXXXX/_packaging/a3fed2a3-b497-407d-a1b5-bb8f7dad0e33/nuget/v3/index.json" rel="nofollow noreferrer">https://tfs.XXXXXX/XXXXX/_packaging/a3fed2a3-b497-407d-a1b5-bb8f7dad0e33/nuget/v3/index.json</a> -isRetry -nonInteractive -verbosity detailed
    2019-04-17T12:14:23.4045752Z CredentialProvider.TeamBuild: URI Prefixes:
    2019-04-17T12:14:23.4045752Z CredentialProvider.TeamBuild:     <a href="https://tfs.XXXXXX/XXXXX/" rel="nofollow noreferrer">https://tfs.XXXXXX/XXXXX/</a>
    2019-04-17T12:14:23.4045752Z CredentialProvider.TeamBuild: URI: <a href="https://tfs.XXXXXX/XXXXX/_packaging/a3fed2a3-b497-407d-a1b5-bb8f7dad0e33/nuget/v3/index.json" rel="nofollow noreferrer">https://tfs.XXXXXX/XXXXX/_packaging/a3fed2a3-b497-407d-a1b5-bb8f7dad0e33/nuget/v3/index.json</a>
    2019-04-17T12:14:23.4045752Z CredentialProvider.TeamBuild: Is retry: True
    2019-04-17T12:14:23.4045752Z CredentialProvider.TeamBuild: Matched prefix: <a href="https://tfs.XXXXXX/XXXXX/" rel="nofollow noreferrer">https://tfs.XXXXXX/XXXXX/</a>
    2019-04-17T12:14:23.7327790Z CredentialProvider.TeamBuild: Failed to authenticate to <a href="https://tfs.XXXXXX/XXXXX/_packaging/a3fed2a3-b497-407d-a1b5-bb8f7dad0e33/nuget/v3/index.json" rel="nofollow noreferrer">https://tfs.XXXXXX/XXXXX/_packaging/a3fed2a3-b497-407d-a1b5-bb8f7dad0e33/nuget/v3/index.json</a> from your project collection, prefix = <a href="https://tfs.XXXXXX/XXXXX/" rel="nofollow noreferrer">https://tfs.XXXXXX/XXXXX/</a>
    2019-04-17T12:14:25.1858247Z   GET <a href="https://api.nuget.org/v3-flatcontainer/MySuperPackage.tools.http/1.8.1/MySuperPackage.tools.http.1.8.1.nupkg" rel="nofollow noreferrer">https://api.nuget.org/v3-flatcontainer/MySuperPackage.tools.http/1.8.1/MySuperPackage.tools.http.1.8.1.nupkg</a>
    2019-04-17T12:14:25.1858247Z   GET <a href="https://api.nuget.org/v3-flatcontainer/MySuperPackage.annuaire.client/1.24.0-dev20190417-04/MySuperPackage.annuaire.client.1.24.0-dev20190417-04.nupkg" rel="nofollow noreferrer">https://api.nuget.org/v3-flatcontainer/MySuperPackage.annuaire.client/1.24.0-dev20190417-04/MySuperPackage.annuaire.client.1.24.0-dev20190417-04.nupkg</a>
    2019-04-17T12:14:25.4045771Z   NotFound <a href="https://api.nuget.org/v3-flatcontainer/MySuperPackage.annuaire.client/1.24.0-dev20190417-04/MySuperPackage.annuaire.client.1.24.0-dev20190417-04.nupkg" rel="nofollow noreferrer">https://api.nuget.org/v3-flatcontainer/MySuperPackage.annuaire.client/1.24.0-dev20190417-04/MySuperPackage.annuaire.client.1.24.0-dev20190417-04.nupkg</a> 193ms
    2019-04-17T12:14:25.4045771Z WARNING: Unable to find version '1.24.0-dev20190417-04' of package 'MySuperPackage.Annuaire.Client'.
    2019-04-17T12:14:25.4045771Z   C:\Users\P-TF18-S-1BuildDev1.nuget\packages: Package 'MySuperPackage.Annuaire.Client.1.24.0-dev20190417-04' is not found on source 'C:\Users\P-TF18-S-1BuildDev1.nuget\packages\'.
    2019-04-17T12:14:25.4045771Z   <a href="https://tfs.XXXXXX/XXXXX/_packaging/a3fed2a3-b497-407d-a1b5-bb8f7dad0e33/nuget/v3/index.json" rel="nofollow noreferrer">https://tfs.XXXXXX/XXXXX/_packaging/a3fed2a3-b497-407d-a1b5-bb8f7dad0e33/nuget/v3/index.json</a>: Unable to load the service index for source <a href="https://tfs.XXXXXX/XXXXX/_packaging/a3fed2a3-b497-407d-a1b5-bb8f7dad0e33/nuget/v3/index.json" rel="nofollow noreferrer">https://tfs.XXXXXX/XXXXX/_packaging/a3fed2a3-b497-407d-a1b5-bb8f7dad0e33/nuget/v3/index.json</a>.
    2019-04-17T12:14:25.4045771Z   Response status code does not indicate success: 403 (Forbidden).
    2019-04-17T12:14:25.4045771Z   <a href="https://api.nuget.org/v3/index.json" rel="nofollow noreferrer">https://api.nuget.org/v3/index.json</a>: Package 'MySuperPackage.Annuaire.Client.1.24.0-dev20190417-04' is not found on source '<a href="https://api.nuget.org/v3/index.json" rel="nofollow noreferrer">https://api.nuget.org/v3/index.json</a>'.
    2019-04-17T12:14:25.4045771Z 
    2019-04-17T12:14:28.7483260Z   NotFound <a href="https://api.nuget.org/v3-flatcontainer/MySuperPackage.tools.http/1.8.1/MySuperPackage.tools.http.1.8.1.nupkg" rel="nofollow noreferrer">https://api.nuget.org/v3-flatcontainer/MySuperPackage.tools.http/1.8.1/MySuperPackage.tools.http.1.8.1.nupkg</a> 3524ms
    2019-04-17T12:14:28.7483260Z WARNING: Unable to find version '1.8.1' of package 'MySuperPackage.Tools.Http'.
    2019-04-17T12:14:28.7483260Z   C:\Users\P-TF18-S-1BuildDev1.nuget\packages: Package 'MySuperPackage.Tools.Http.1.8.1' is not found on source 'C:\Users\P-TF18-S-1BuildDev1.nuget\packages\'.
    2019-04-17T12:14:28.7483260Z   <a href="https://tfs.XXXXXX/XXXXX/_packaging/a3fed2a3-b497-407d-a1b5-bb8f7dad0e33/nuget/v3/index.json" rel="nofollow noreferrer">https://tfs.XXXXXX/XXXXX/_packaging/a3fed2a3-b497-407d-a1b5-bb8f7dad0e33/nuget/v3/index.json</a>: Unable to load the service index for source <a href="https://tfs.XXXXXX/XXXXX/_packaging/a3fed2a3-b497-407d-a1b5-bb8f7dad0e33/nuget/v3/index.json" rel="nofollow noreferrer">https://tfs.XXXXXX/XXXXX/_packaging/a3fed2a3-b497-407d-a1b5-bb8f7dad0e33/nuget/v3/index.json</a>.
    2019-04-17T12:14:28.7483260Z   Response status code does not indicate success: 403 (Forbidden).
    2019-04-17T12:14:28.7483260Z   <a href="https://api.nuget.org/v3/index.json" rel="nofollow noreferrer">https://api.nuget.org/v3/index.json</a>: Package 'MySuperPackage.Tools.Http.1.8.1' is not found on source '<a href="https://api.nuget.org/v3/index.json" rel="nofollow noreferrer">https://api.nuget.org/v3/index.json</a>'.
    2019-04-17T12:14:28.7483260Z 
    2019-04-17T12:14:28.7795774Z 
    2019-04-17T12:14:28.7795774Z Errors in packages.config projects
    2019-04-17T12:14:28.7795774Z     Unable to find version '1.24.0-dev20190417-04' of package 'MySuperPackage.Annuaire.Client'.
    2019-04-17T12:14:28.7795774Z 
    2019-04-17T12:14:28.7795774Z       C:\Users\P-TF18-S-1BuildDev1.nuget\packages: Package 'MySuperPackage.Annuaire.Client.1.24.0-dev20190417-04' is not found on source 'C:\Users\P-TF18-S-1BuildDev1.nuget\packages\'.
    2019-04-17T12:14:28.7795774Z       <a href="https://tfs.XXXXXX/XXXXX/_packaging/a3fed2a3-b497-407d-a1b5-bb8f7dad0e33/nuget/v3/index.json" rel="nofollow noreferrer">https://tfs.XXXXXX/XXXXX/_packaging/a3fed2a3-b497-407d-a1b5-bb8f7dad0e33/nuget/v3/index.json</a>: Unable to load the service index for source <a href="https://tfs.XXXXXX/XXXXX/_packaging/a3fed2a3-b497-407d-a1b5-bb8f7dad0e33/nuget/v3/index.json" rel="nofollow noreferrer">https://tfs.XXXXXX/XXXXX/_packaging/a3fed2a3-b497-407d-a1b5-bb8f7dad0e33/nuget/v3/index.json</a>.
    2019-04-17T12:14:28.7795774Z       Response status code does not indicate success: 403 (Forbidden).
    2019-04-17T12:14:28.7795774Z       <a href="https://api.nuget.org/v3/index.json" rel="nofollow noreferrer">https://api.nuget.org/v3/index.json</a>: Package 'MySuperPackage.Annuaire.Client.1.24.0-dev20190417-04' is not found on source '<a href="https://api.nuget.org/v3/index.json" rel="nofollow noreferrer">https://api.nuget.org/v3/index.json</a>'.
    2019-04-17T12:14:28.7795774Z     Unable to find version '1.8.1' of package 'MySuperPackage.Tools.Http'.
    2019-04-17T12:14:28.7795774Z       C:\Users\P-TF18-S-1BuildDev1.nuget\packages: Package 'MySuperPackage.Tools.Http.1.8.1' is not found on source 'C:\Users\P-TF18-S-1BuildDev1.nuget\packages\'.
    2019-04-17T12:14:28.7795774Z       <a href="https://tfs.XXXXXX/XXXXX/_packaging/a3fed2a3-b497-407d-a1b5-bb8f7dad0e33/nuget/v3/index.json" rel="nofollow noreferrer">https://tfs.XXXXXX/XXXXX/_packaging/a3fed2a3-b497-407d-a1b5-bb8f7dad0e33/nuget/v3/index.json</a>: Unable to load the service index for source <a href="https://tfs.XXXXXX/XXXXX/_packaging/a3fed2a3-b497-407d-a1b5-bb8f7dad0e33/nuget/v3/index.json" rel="nofollow noreferrer">https://tfs.XXXXXX/XXXXX/_packaging/a3fed2a3-b497-407d-a1b5-bb8f7dad0e33/nuget/v3/index.json</a>.
    2019-04-17T12:14:28.7795774Z       Response status code does not indicate success: 403 (Forbidden).
    2019-04-17T12:14:28.7795774Z       <a href="https://api.nuget.org/v3/index.json" rel="nofollow noreferrer">https://api.nuget.org/v3/index.json</a>: Package 'MySuperPackage.Tools.Http.1.8.1' is not found on source '<a href="https://api.nuget.org/v3/index.json" rel="nofollow noreferrer">https://api.nuget.org/v3/index.json</a>'.
    2019-04-17T12:14:28.7795774Z NuGet Config files used:
    2019-04-17T12:14:28.7795774Z     D:\BuildAgents\Dev-AgentCtrl-05_work\48\Nuget\tempNuGet_59927.config
    2019-04-17T12:14:28.7795774Z 
    2019-04-17T12:14:28.7795774Z Feeds used:
    2019-04-17T12:14:28.7795774Z     C:\Users\P-TF18-S-1BuildDev1.nuget\packages\
    2019-04-17T12:14:28.7795774Z     <a href="https://tfs.XXXXXX/XXXXX/_packaging/a3fed2a3-b497-407d-a1b5-bb8f7dad0e33/nuget/v3/index.json" rel="nofollow noreferrer">https://tfs.XXXXXX/XXXXX/_packaging/a3fed2a3-b497-407d-a1b5-bb8f7dad0e33/nuget/v3/index.json</a>
    2019-04-17T12:14:28.7795774Z     <a href="https://api.nuget.org/v3/index.json" rel="nofollow noreferrer">https://api.nuget.org/v3/index.json</a>
    2019-04-17T12:14:28.8265728Z ##[error]Error: D:\BuildAgents\Dev-AgentCtrl-05_work_tool\NuGet\4.0.0\x64\nuget.exe failed with return code: 1
    2019-04-17T12:14:28.8265728Z ##[error]Packages failed to restore
    2019-04-17T12:14:28.8265728Z ##[section]Finishing: NuGet restore ***.sln</p>
  </blockquote></li>
  </ul>