Fix Google Cloud (gcloud) & Azure CLI (az login) SSL Certificate Errors on Mac
Fix gcloud CERTIFICATE_VERIFY_FAILED and Azure CLI az login SSL verification errors behind Zscaler, Cloudflare WARP, or Netskope on macOS without disabling certificate checks.
SWG bar · Updated
On a corporate Mac behind Zscaler, Cloudflare WARP, Netskope, Cisco Umbrella, or Palo Alto GlobalProtect, Google Cloud CLI (gcloud, gsutil, bq) and Azure CLI (az login, az account, az aks) frequently abort with:
urllib3.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED]
certificate verify failed: unable to get local issuer certificate
Both CLIs ship bundled Python runtimes (certifi / httplib2) that ignore macOS System Keychain. Worse, many official SWG docs only publish Windows C:\Program Files (x86)\Microsoft SDKs\Azure paths for Azure CLI and omit macOS completely. Paste your raw log into our free SWG & SSL Error Decoder or apply the upgrade-safe macOS fixes below.
1. Export your corporate SWG Root CA and combined bundle on macOS
Create both a standalone corporate SWG PEM (for gcloud) and a combined macOS System Roots + Corporate SWG PEM (for Azure CLI requests / Python):
mkdir -p "$HOME/.certs"
# 1. Standalone corporate SWG Root CA (replace "Zscaler" with Cloudflare, goskope, Cisco Umbrella, Fortinet, etc.)
security find-certificate -c "Zscaler" -p /Library/Keychains/System.keychain > "$HOME/.certs/corporate-swg-root.pem"
# 2. Combined bundle (macOS trusted public roots + corporate SWG root)
security find-certificate -a -p /System/Library/Keychains/SystemRootCertificates.keychain > "$HOME/.certs/cloud-combined-ca.pem"
cat "$HOME/.certs/corporate-swg-root.pem" >> "$HOME/.certs/cloud-combined-ca.pem"
2. Fix Google Cloud CLI (gcloud, gcloud storage, bq) on macOS
Google Cloud SDK provides a first-class configuration property that cleanly merges your custom CA with its default truststore:
gcloud config set core/custom_ca_certs_file "$HOME/.certs/corporate-swg-root.pem"
Verify that authentication and component checks now succeed:
gcloud auth list
gcloud components list
Extra tips for Google Cloud on macOS
- Multiple
gcloudconfigurations or scripts: Export the environment variable in~/.zshrcso everygcloudconfig inherits it:echo 'export CLOUDSDK_CORE_CUSTOM_CA_CERTS_FILE="$HOME/.certs/corporate-swg-root.pem"' >> ~/.zshrc - Legacy
gsutilcommands: Prefergcloud storage(which usescore/custom_ca_certs_file). If a legacy script still callsgsutil, add[Boto]→ca_certificates_file = /Users/<you>/.certs/cloud-combined-ca.pemto~/.boto.
3. Fix Azure CLI (az login / Homebrew azure-cli) on macOS
Many older blog posts tell Mac users to append the Zscaler certificate directly into /opt/homebrew/Cellar/azure-cli/*/libexec/lib/python*/site-packages/certifi/cacert.pem. Avoid editing the Cellar file directly—every brew upgrade azure-cli overwrites it and breaks az login again.
Instead, point Azure CLI’s requests stack to your combined CA bundle in ~/.zshrc:
echo 'export REQUESTS_CA_BUNDLE="$HOME/.certs/cloud-combined-ca.pem"' >> ~/.zshrc
echo 'export SSL_CERT_FILE="$HOME/.certs/cloud-combined-ca.pem"' >> ~/.zshrc
source ~/.zshrc
Then test login cleanly (never leave AZURE_CLI_DISABLE_CONNECTION_VERIFICATION=1 enabled in your shell):
az login
az account show
(Note: If you run az acr login or az aks get-credentials, Docker and kubectl use separate Go TLS stores—make sure Docker Desktop is restarted after Keychain updates, or see our Python & Docker SSL guide.)
4. Per-domain SWG bypass for cloud APIs on Mac
If your company network permits per-domain SWG bypass for cloud control planes, SWG bar detects whether Google Cloud (oauth2.googleapis.com, www.googleapis.com) or Microsoft Azure (login.microsoftonline.com, management.azure.com) is being intercepted and restores the genuine provider certificate in one click:
swgbar probe oauth2.googleapis.com
swgbar bypass enable oauth2.googleapis.com
swgbar bypass enable login.microsoftonline.com
swgbar bypass enable management.azure.com
Working across multi-cloud on the same Mac? See Fix AWS CLI & Boto3 SSL validation failed on Mac, Fix Java, Maven, Gradle & Android Studio PKIX errors, and How to bypass SWG on a Mac.