-
Notifications
You must be signed in to change notification settings - Fork 3.4k
MSAL authentication doesn't respect REQUESTS_CA_BUNDLE for proxy certificates #32207
Copy link
Copy link
Open
Labels
Accountaz login/accountaz login/accountAuto-AssignAuto assign by botAuto assign by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamThe command of the issue is owned by Azure CLI teamComputeaz vm/vmss/image/disk/snapshotaz vm/vmss/image/disk/snapshotPossible-SolutionSimilar-Issueact-identity-squadact-observability-squadcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.Issues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
Milestone
Metadata
Metadata
Assignees
Labels
Accountaz login/accountaz login/accountAuto-AssignAuto assign by botAuto assign by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamThe command of the issue is owned by Azure CLI teamComputeaz vm/vmss/image/disk/snapshotaz vm/vmss/image/disk/snapshotPossible-SolutionSimilar-Issueact-identity-squadact-observability-squadcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.Issues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
Describe the bug
MSAL authentication in Azure CLI doesn't respect the
REQUESTS_CA_BUNDLEenvironment variable whenworking behind a proxy with custom certificates. While other Azure CLI operations properly use custom CA
bundles specified via
REQUESTS_CA_BUNDLE, the MSAL library used for authentication (particularlyaz login) ignores this setting, causing SSL certificate verification errors even when users have correctlyconfigured their proxy certificates according to the official documentation.
Related command
az login
az login --debug
Errors
Certificate verification failed. This typically happens when using Azure CLI behind a proxy that intercepts traffic with a self-signed certificate.
SSL: CERTIFICATE_VERIFY_FAILED
Issue script & Debug output
Environment setup
export HTTPS_PROXY=https://corporate-proxy:8080
export REQUESTS_CA_BUNDLE=/path/to/custom-ca-bundle.pem
Run login with debug
az login --debug
Debug output shows NO indication of using custom cert bundle for MSAL:
DEBUG: Getting management service client client_type=SubscriptionClient
DEBUG: urllib3.connectionpool: Starting new HTTPS connection
ERROR: SSL: CERTIFICATE_VERIFY_FAILED
Expected debug output (missing):
DEBUG: MSAL: Using CA bundle file at '/path/to/custom-ca-bundle.pem'
Other az commands work fine with the same REQUESTS_CA_BUNDLE:
az vm list --debug
Shows: DEBUG: Using CA bundle file at '/path/to/custom-ca-bundle.pem'
Expected behavior
When
REQUESTS_CA_BUNDLEenvironment variable is set:az login --debugshould show debug message indicating the custom CA bundle is being usedvariable
This is documented behavior according to:
https://learn.microsoft.com/en-us/cli/azure/use-azure-cli-successfully-troubleshooting#work-behind-a-pro
xy
Environment Summary
azure-cli 2.77.0
core 2.77.0
telemetry 1.1.0
Dependencies:
msal 1.34.0b1
azure-mgmt-resource 23.3.0
Python location '/opt/homebrew/Cellar/azure-cli/2.77.0/libexec/bin/python'
Config directory '/Users/ciaranfinnegan/.azure'
Extensions directory '/Users/ciaranfinnegan/.azure/cliextensions'
Python (Darwin) 3.13.7 (main, Aug 14 2025, 11:12:11) [Clang 17.0.0 (clang-1700.0.13.3)]
Additional context
No response