TFS vNext build agent fails with 407 proxy authentication error
<p>Triggering a build from Visual Studio Team Services on an on-premise vNext build agent fails at the point of getting sources from the repo, presumably because of a corporate proxy.
The build log on VSTS shows:</p>

<pre><code>2016-01-28T12:35:03.7688078Z Syncing repository: MyProject (TFVC)
2016-01-28T12:35:03.7688078Z workspaceName=ws_3_3
2016-01-28T12:35:05.0730362Z ##[error]HTTP code 407: Proxy Authentication Required
2016-01-28T12:35:05.3257849Z ##[error]Prepare repository failed with exception.
</code></pre>

<p>On the build server the agent log shows the following exception:</p>

<pre><code>16:17:14.895983 System.AggregateException: One or more errors occurred. ---&gt; Microsoft.TeamFoundation.DistributedTask.Agent.Common.AgentExecutionTerminationException: Prepare repository failed with exception. ---&gt; Microsoft.TeamFoundation.TeamFoundationServiceUnavailableException: HTTP code 407: Proxy Authentication Required ---&gt; System.Net.WebException: The remote server returned an error: (407) Proxy Authentication Required.

16:17:14.895983    at System.Net.HttpWebRequest.GetRequestStream(TransportContext&amp; context)    
16:17:14.895983    at System.Net.HttpWebRequest.GetRequestStream()
16:17:14.895983    at Microsoft.TeamFoundation.Client.Channels.TfsHttpWebRequest.SendRequestAndGetResponse(HttpWebRequest webRequest, WebException&amp; webException)
16:17:14.895983    --- End of inner exception stack trace ---
16:17:14.895983    at Microsoft.TeamFoundation.Client.Channels.TfsHttpWebRequest.ReadResponse(HttpWebResponse webResponse, WebException webException)
16:17:14.895983    at Microsoft.TeamFoundation.Client.Channels.TfsHttpWebRequest.IsAuthenticationChallenge(TfsMessage requestMessage, HttpWebResponse webResponse, WebException webException, TfsMessage&amp; responseMessage)
16:17:14.895983    at Microsoft.TeamFoundation.Client.Channels.TfsHttpWebRequest.SendRequest()
16:17:14.895983    at Microsoft.TeamFoundation.Client.Channels.TfsHttpRequestChannel.Request(TfsMessage message, TimeSpan timeout)
16:17:14.895983    at Microsoft.TeamFoundation.Client.Channels.TfsHttpClientBase.Invoke(TfsClientOperation operation, Object[] parameters, TimeSpan timeout, Object[]&amp; outputs)
16:17:14.895983    at Microsoft.TeamFoundation.Framework.Client.LocationWebService.Connect(Int32 connectOptions, Int32 lastChangeId, Int32 features)
16:17:14.895983    at Microsoft.TeamFoundation.Framework.Client.FrameworkServerDataProvider.Connect(ConnectOptions connectOptions)
16:17:14.895983    at Microsoft.TeamFoundation.Framework.Client.FrameworkServerDataProvider.EnsureConnected(ConnectOptions optionsNeeded)
16:17:14.895983    at Microsoft.TeamFoundation.Framework.Client.FrameworkServerDataProvider.get_AuthorizedIdentity()
16:17:14.895983    at Microsoft.TeamFoundation.VersionControl.Client.Client.ResolveUserUniqueName(String user)
16:17:14.895983    at Microsoft.TeamFoundation.VersionControl.Client.Client.GetLocalWorkspace(String workspaceName, String workspaceOwner)
16:17:14.895983    at Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.TfvcHelper.SyncRepository(VersionControlServer server, Uri repositoryUrl, String workspaceName, String rootPath, WorkingFolder[] workingFolders, String sourceVersion, Boolean cleanRepository, String shelveset, CancellationToken cancellationToken)
16:17:14.895983    at Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.TfvcHelper.Sync(ITaskEndpoint endpoint, String localPath, Dictionary`2 serverPathMapping, String sourceVersion, Boolean cleanRepository, String workspaceName, String shelveset, String&amp; actualSourceVersion, CancellationToken cancellationToken)
16:17:14.895983    at Microsoft.TeamFoundation.DistributedTask.Plugin.Build.TfvcSourceProvider.&lt;&gt;c__DisplayClass3_0.&lt;PrepareRepositoryAsync&gt;b__0()
16:17:14.895983    --- End of inner exception stack trace ---
</code></pre>

<p>There are a lot of similar questions about the 407 proxy authentication error, with suggestions of config files to change, but none specific to the problem of the vNext build agent. Is there a config file somewhere that I can edit to fix this problem?</p>