1

We have been working on setting up thebuild definition on the on Premise TFS 2015 server, however are stuck with the proxy issue that’s coming while running a build task (Azure powershell). The build task actually makes a call out to Azure to add an authenticated account to be used for Azure cmdlets, but however getting blocked by the proxy server as seen below. We need a way to pass current user credentials to the Azure Powershell cmdlets, any help would be appreciated.

Error Message Network Access Message: The page cannot be displayed Technical Information (for Support personnel) Error Code: 407 Proxy Authentication Required. The ISA Server requires authorization to fulfill the request. Access to the Web Proxy filter is denied. (12209) IP Address: some IP address Date: 17/03/2017 09:03:58 [GMT] Server: ..com Source: proxy

Tried putting [System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials in the custom PowerShell script to be run as the task, however it gets blocked before entering the custom script. Basically, before running the custom script, Azure PowerShell build task tries to run Add-AzureRmAccount which makes a call out to Azure to add an authenticated account to be used for Azure cmdlets where it gets blocked by the proxy.

Sagar M
  • 11
  • 2
  • Do you put [System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials at the start of your script? Do you get the same error if you run script in a single powershell? – Cece Dong - MSFT Mar 20 '17 at 09:05
  • Try to create a custom build task extension and add that code to the first line. More information about extension: https://www.visualstudio.com/en-us/docs/integrate/extensions/develop/add-build-task – starian chen-MSFT Mar 23 '17 at 08:07
  • We tried above but did not work, we also tried passing the proxy credentials through powershell.exe.config, that too didn't work. Digging into the issue found that, the proxy blocking was happening on the initial handshake between the Azure PowerShell task and Azure Subscription. Basically, before running the custom PowerShell script, Azure PowerShell build task tries to run Add-AzureRmAccount which makes a call out to Azure to add an authenticated account to be used for Azure cmdlets and this is where it gets blocked by the proxy(proxy authentication required error code 407). – Sagar M Mar 27 '17 at 11:59

1 Answers1

0

Finally, had to go to the basics, we switched to simple PowerShell task instead of Azure PowerShell for doing the initial handshake and passing the default credentials to the proxy.

Here's the link to the detailed workaround.

Sagar M
  • 11
  • 2