How to configure azure-cli behind a corporate proxy on Windows

Viewed 6487

I'm using Windows 10 behind a corporate proxy and az --version outputs the following:

azure-cli                          2.5.1

command-modules-nspkg              2.0.3
core                               2.5.1
nspkg                              3.0.4
telemetry                          1.0.4
...
Unable to check if your CLI is up-to-date. Check your internet connection.

Furthermore, az extension list-available throws:

Unable to get extension index.
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.', OSError('Tunnel connection failed: 403 Forbidden',)))

How to configure azure-cli for the corporate proxy?

2 Answers
  1. Download local proxy configuration from http://wpad/wpad.dat
  2. At the beginning of the wpad.dat file there is a line similar to CWSProxy="PROXY proxy.corporation.com:8082";
  3. Enter the proxy server to environment variable HTTPS_PROXY, e.g. in bash: export HTTPS_PROXY="proxy.corporation.com:8082"

Now az extension list-available connects. However, for some reason, az --version is still giving Unable to check if your CLI is up-to-date. Check your internet connection. You can now anyway install extensions such as az extension add --name azure-devops.

Related