[authentication] Enable broker based authentication on macOS ARM64 (opt-in via enable_broker_on_mac=true)#33376
[authentication] Enable broker based authentication on macOS ARM64 (opt-in via enable_broker_on_mac=true)#33376naga-nandyala wants to merge 1 commit into
Conversation
- Add enable_broker_on_mac config (default: False, opt-in via core.enable_broker_on_mac=true) - Pass enable_broker_on_mac to MSAL Identity and PublicClientApplication - Add EnableBrokerOnMac telemetry property - Install msal[broker] on darwin in addition to win32 - Add requirements.py3.MacOS.txt with msal[broker] and pymsalruntime pinned - Update build script to use MacOS requirements file - Add unit tests for broker_on_mac default and opt-in behavior Supersedes Azure#32773
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
There was a problem hiding this comment.
Pull request overview
This PR adds opt-in macOS broker authentication support for az login, wiring the new setting through Azure CLI Core authentication, telemetry, packaging, and macOS release dependencies.
Changes:
- Adds
core.enable_broker_on_machandling and passes it into MSAL Identity/PublicClientApplication. - Records macOS broker state in telemetry and adds unit coverage for default/opt-in behavior.
- Adds a macOS-specific pinned requirements file and updates the macOS binary packaging script to use it.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/azure-cli/requirements.py3.MacOS.txt |
Adds a macOS-specific dependency lockfile with broker MSAL runtime dependencies. |
src/azure-cli-core/setup.py |
Expands MSAL broker extra installation to macOS. |
src/azure-cli-core/azure/cli/core/tests/test_profile.py |
Adds tests for default and enabled macOS broker config behavior. |
src/azure-cli-core/azure/cli/core/telemetry.py |
Adds telemetry property for macOS broker enablement. |
src/azure-cli-core/azure/cli/core/auth/identity.py |
Passes macOS broker enablement into MSAL public client kwargs. |
src/azure-cli-core/azure/cli/core/_profile.py |
Reads macOS broker config and forwards it to telemetry and Identity. |
scripts/release/macos/build_binary_tar_gz.py |
Switches macOS binary packaging to the new macOS requirements file. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| 'msal-extensions==1.3.1', | ||
| 'msal[broker]==1.35.1; sys_platform == "win32"', | ||
| 'msal==1.35.1; sys_platform != "win32"', | ||
| 'msal[broker]==1.35.1; sys_platform == "win32" or sys_platform == "darwin"', |
| # On Windows, use core.enable_broker_on_windows=false to disable broker (WAM) for authentication. | ||
| enable_broker_on_windows = cli_ctx.config.getboolean('core', 'enable_broker_on_windows', fallback=True) | ||
| # On macOS, broker authentication is opt-in. Use core.enable_broker_on_mac=true to enable it. | ||
| enable_broker_on_mac = cli_ctx.config.getboolean('core', 'enable_broker_on_mac', fallback=False) |
| SRC_DIR = PROJECT_ROOT / "src" | ||
| AZURE_CLI_CORE_DIR = SRC_DIR / "azure-cli-core" | ||
| REQUIREMENTS_FILE = SRC_DIR / "azure-cli" / "requirements.py3.Darwin.txt" | ||
| REQUIREMENTS_FILE = SRC_DIR / "azure-cli" / "requirements.py3.MacOS.txt" |
Related command
az {login}
Description
Changes:
enable_broker_on_macflag to MSAL Identity and PublicClientApplicationFalse). Users enable viaaz config set core.enable_broker_on_mac=truemsal[broker]ondarwinin addition towin32(setup.py)requirements.py3.MacOS.txtwithmsal[broker]andpymsalruntimepinnedrequirements.py3.MacOS.txtEnableBrokerOnMactelemetry custom propertyNote: Currently supported on macOS ARM64 only.
Supersedes #32773
Testing Guide
az login— should work as before (broker disabled by default on macOS)az config set core.enable_broker_on_mac=truethenaz login— should use broker authenticationaz config unset core.enable_broker_on_mac— reverts to default (no broker)History Notes
This checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.