Hi everyone,
Hope you may help here.
I’m trying to create a simple Invoke-WebRequest inside PowerShell, the issue is that no matter which method of setting the proxy I chose, ZScaler keeps rejecting the access to the website.
The proxy is set through IE settings, http://URL:80, this proxy works when opening the browser and authenticating using SSO/SAML, however the same is impossible to do through PowerShell.
Specifying -Proxy as well as -ProxyCredentials, and entering my SSO credentials does not seems to work.
Invoke-WebRequest -Uri "https://github.com" -Proxy "http://gateway.zscloud.net:80" -ProxyCredential $Credentials
If I add in -Headers to act as a browser, I get the ZScaler login authentication page.
-Headers @{‘Proxy-Connection’=‘keep-alive’;‘User-Agent’=‘Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.114 Safari/537.36 Edg/103.0.1264.49’}
HTTP/1.1 200 OK
Server: Zscaler/6.1
<!--samlchecks_get.html --><!DOCTYPE html><html><head><title>Welcome To Zscaler Directory Authentication</title><meta name="viewport" content="width=device-width, initial-scale=1"><style type="text/cs…
{@{outerHTML=<img id="cmpy_info" src="https://login.zscloud.net:443/__zsig/Q32M2qt2rUvR4">; tagName=IMG; id=cmpy_info; src=https://login.zscloud.net:443/__zsig/Q32M2qt2rUvR4}}
So even though I’m already authenticated inside the browser, I still receive the SAML authentication page without it redirecting me to the actual destination host.