Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting up az cli, however I cannot connect due to max retries failed, target host refused the connection. How can I get past my proxy in Windows?

I've followed Microsoft's instructions for "Proxy Blocks a Connection", which reads:

(New-Object System.Net.WebClient).Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials

...however I'm still receiving the following error when attempting to do az login or az extension add --name azure-devops:

Please ensure you have network connection. Error detail: HTTPSConnectionPool(host='aka.ms', port=443): Max retries exceeded with url: /azure-cli-extension-index-v1 (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x0448E9F0>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it',)))

I'm trying to connect to our company's Org on dev.azure.com. I've searched and have not come across anything that helps.

Thanks - please let me know if there is more info that's needed. I know the address & port of my proxy, (http/s://proxy.{env}.{org}.com:{PORT}), however I don't see a way to explicitly state this, or if it would even work.

TIA

like image 520
new2tech Avatar asked Nov 24 '25 11:11

new2tech


1 Answers

Refer

  • Work behind a proxy
  • Working with Azure CLI behind SSL intercepting proxy server
  • How to configure proxies for the Azure libraries

Depending on whether you use cmd or bash, set the HTTP_PROXY or HTTPS_PROXY environment variable as below:

CMD:

rem Non-authenticated HTTP server:
set HTTP_PROXY=http://{proxy host}:{port}

rem Authenticated HTTP server:
set HTTP_PROXY=http://username:password@{proxy host}:{port}

rem Non-authenticated HTTPS server:
set HTTPS_PROXY=http://{proxy host}:{port}

rem Authenticated HTTPS server:
set HTTPS_PROXY=http://username:password@{proxy host}:{port}

Bash:

# Non-authenticated HTTP server:
HTTP_PROXY=http://{proxy host}:{port}

# Authenticated HTTP server:
HTTP_PROXY=http://username:password@{proxy host}:{port}

# Non-authenticated HTTPS server:
HTTPS_PROXY=http://{proxy host}:{port}

# Authenticated HTTPS server:
HTTPS_PROXY=http://username:password@{proxy host}:{port}
like image 80
krishg Avatar answered Nov 26 '25 23:11

krishg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!