How to specify a user id and password for Visual Studio Code with an authenticating proxy?
I've seen the Proxy Server Support on the main VS Code site, but this only mentions two settings ...
"http.proxy": "http://10.203.0.1:5187/"
"http.proxyStrictSSL": false
I've set these, but still no luck, e.g. I can't install extensions ... can't even get a list of them
I suspect it's our proxy, as it needs a user id and password :-(
So how can you set these values?
My favorite response here is David Martin's suggestion of using Fiddler. But in case that is not something you want to undertake, below is how to set your credentials for the proxy.
To specify DOMAIN + username + password: (It will likely not work with a slash, so use %5C in the place of the slash as shown below)
To specify just username + password:
Please take ref to this article. https://taeguk.co.uk/blog/working-in-visual-studio-behind-the-firewall/
Let’s assume my NTLM login is DOMAIN\User Name and my password is P@ssword! The format for the credentials needs to be DOMAIN\User Name:P@ssword!, but you need to URL Encode the user name and password. A simple online URL encoded can translate your username and password to: DOMAIN%5CUser%20Name and P%40ssword!. Piece all this info into a single string like so: http://DOMAIN%5CUser%20Name:P%40ssword!@proxy-cluster.fqdn.local:8881 Then add this into your User Settings in File, Preferences against the "http.proxy" value: // Place your settings in this file to overwrite the default settings { "http.proxy": "http://DOMAIN%5CUser%20Name:P%40ssword!@proxy-cluster.fqdn.local:8881" }
If you don't want to store your credentials in the settings file, fiddler can be used to proxy the call to the proxy. Furthermore, I believe the above only works for proxy servers using basic authentication, the following should work for NTLM.
VSCode Open Settings File:
add the following:
Fiddler Confirm fiddler settings:
Fiddler Ensure Fiddler set to automatically authenticate:
VSCode Extensions should now be online:
Update
This is now no longer required following implementation of PR #22369 which was implemented in version 1.15 Proxy server authentication.
In my case I still needed to add:
The venerable CNTLM could help you. You give it your credentials, tell it about the upstream proxy, run it on your local machine, then point VS to the proxy at http://localhost:3128.
http://cntlm.sourceforge.net/
It's a handy solution for any application that doesn't support authenticated proxies.
Set credentials inside the proxy url:
"http.proxy": "http://DOMAIN//USER:PASSWORD@wsg.test.com:8080". Do not forget to add the port.