epp
epp

Reputation: 321

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

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?

Upvotes: 3

Views: 14213

Answers (2)

epp
epp

Reputation: 321

  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.

Upvotes: 2

Nancy Xiong
Nancy Xiong

Reputation: 28234

From https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-windows?view=azure-cli-latest&tabs=azure-cli#proxy-blocks-connection

For Windows 10, you could check the proxy settings in the Settings > Network & Internet > Proxy pane. Contact your system administrator for the required settings, or for situations where your machine may be configuration-managed or require advanced setup.

enter image description here

Upvotes: 0

Related Questions