Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/azure-cli-core/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Release History
++++++
* Resolve CVE-2026-48526 (#33562)
* Update global policy argument `--acquire-policy-token` to pick up new api-version and propagate correlation-id (#33661)
* `az login`: Pass `verify=False` to MSAL when `AZURE_CLI_DISABLE_CONNECTION_VERIFICATION` is set, so login works behind TLS inspection proxies (#33716)

2.87.0
++++++
Expand Down
8 changes: 7 additions & 1 deletion src/azure-cli-core/azure/cli/core/auth/identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,20 @@ def _msal_app_kwargs(self):
if self._use_msal_http_cache and not Identity._msal_http_cache:
Identity._msal_http_cache = self._load_msal_http_cache()

return {
from ..util import should_disable_connection_verify
kwargs = {
"authority": self._msal_authority,
"token_cache": Identity._msal_token_cache,
"http_cache": Identity._msal_http_cache,
"instance_discovery": self._instance_discovery,
# CP1 means we can handle claims challenges (CAE)
"client_capabilities": None if "AZURE_IDENTITY_DISABLE_CP1" in os.environ else ["CP1"]
}
# Honor AZURE_CLI_DISABLE_CONNECTION_VERIFICATION for MSAL requests (such as the OIDC
# discovery request during login), so that login works behind TLS inspection proxies.
if should_disable_connection_verify():
kwargs["verify"] = False
return kwargs

@property
def _msal_public_app_kwargs(self):
Expand Down
12 changes: 12 additions & 0 deletions src/azure-cli-core/azure/cli/core/auth/tests/test_identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,18 @@ def test_logout_service_principal(self, init_mock, remove_tokens_for_client_mock
remove_tokens_for_client_mock.assert_called_once()
remove_entry_mock.assert_called_with(client_id)

def test_msal_app_kwargs_verify_default(self):
# By default, no 'verify' kwarg is passed to MSAL apps.
identity = Identity('https://login.microsoftonline.com')
assert 'verify' not in identity._msal_app_kwargs

def test_msal_app_kwargs_disable_connection_verify(self):
# When AZURE_CLI_DISABLE_CONNECTION_VERIFICATION is set, verify=False is passed to MSAL apps
# so that login works behind TLS inspection proxies.
with mock.patch.dict(os.environ, {"AZURE_CLI_DISABLE_CONNECTION_VERIFICATION": "1"}):
identity = Identity('https://login.microsoftonline.com')
assert identity._msal_app_kwargs['verify'] is False


class TestServicePrincipalAuth(unittest.TestCase):

Expand Down
Loading