Tracing HTTP requests with Fiddler
Tracing HTTP requests with Fiddler
When using the az
CLI, it sometimes is helpful to understand which APIs it calls 'under the hood', i.e. so see which Azure REST APIs are called. On Windows, you can use a tool like Fiddler to inspect outgoing HTTP(s) requests. Fiddler does this by 'launching a man-in-the-middle attack' against the applications, by injecting a self-signed X.509 certificate into the Windows cert store, and then pretending to be the external web site.
However, different applications read the HTTP/HTTPS proxy information from different locations:
In .NET, one can set a global (static)
System.Net.WebRequest.DefaultWebProxy
variableWindows applications (like web browsers) check the Windows registry, in particular the
HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyServer
valuesUnix-style applications (like the Python-based
az
utility) check theHTTP_PROXY
andHTTPS_PROXY
environment variablesOther applications require you to explicitly specify the proxy to use via command line, such as
curl
supporting the--proxy ...
and--insecure
args.
On the security side, you need to convince the apps to accept Fiddler's self-cooked TLS cert:
Windows apps check the X509 cert chain, using the
MACHINE\root
storecurl
can be convinced using the--insecure
arg to ignore certificate validity problemsThe
az
CLI needs theADAL_PYTHON_SSL_NO_VERIFY
andAZURE_CLI_DISABLE_CONNECTION_VERIFICATION
environment variables to be set, to skip checking the server's TLS cert.
Setting the proxy in Powershell
Here's how to set a gazillion different settings to make sure Fiddler is used.
Checking the current settings
Deleting the registry entry again
Last updated