Skip to content

Commit 246725e

Browse files
authored
{Core} Replace allow_broker with enable_broker_on_windows (#27726)
1 parent c07e25a commit 246725e

4 files changed

Lines changed: 15 additions & 14 deletions

File tree

src/azure-cli-core/azure/cli/core/_profile.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -856,13 +856,14 @@ def _create_identity_instance(cli_ctx, *args, **kwargs):
856856
# EXPERIMENTAL: Use core.use_msal_http_cache=False to turn off MSAL HTTP cache.
857857
use_msal_http_cache = cli_ctx.config.getboolean('core', 'use_msal_http_cache', fallback=True)
858858

859-
# PREVIEW: On Windows, use core.allow_broker=true to use broker (WAM) for authentication.
860-
allow_broker = cli_ctx.config.getboolean('core', 'allow_broker', fallback=False)
859+
# PREVIEW: On Windows, use core.enable_broker_on_windows=true to use broker (WAM) for authentication.
860+
enable_broker_on_windows = cli_ctx.config.getboolean('core', 'enable_broker_on_windows', fallback=False)
861861
from .telemetry import set_broker_info
862-
set_broker_info(allow_broker=allow_broker)
862+
set_broker_info(enable_broker_on_windows)
863863

864864
# PREVIEW: In Azure Stack environment, use core.instance_discovery=false to disable MSAL's instance discovery.
865865
instance_discovery = cli_ctx.config.getboolean('core', 'instance_discovery', True)
866866

867-
return Identity(*args, encrypt=encrypt, use_msal_http_cache=use_msal_http_cache, allow_broker=allow_broker,
867+
return Identity(*args, encrypt=encrypt, use_msal_http_cache=use_msal_http_cache,
868+
enable_broker_on_windows=enable_broker_on_windows,
868869
instance_discovery=instance_discovery, **kwargs)

src/azure-cli-core/azure/cli/core/auth/identity.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class Identity: # pylint: disable=too-many-instance-attributes
5454
_service_principal_store_instance = None
5555

5656
def __init__(self, authority, tenant_id=None, client_id=None, encrypt=False, use_msal_http_cache=True,
57-
allow_broker=None, instance_discovery=None):
57+
enable_broker_on_windows=None, instance_discovery=None):
5858
"""
5959
:param authority: Authentication authority endpoint. For example,
6060
- AAD: https://login.microsoftonline.com
@@ -69,7 +69,7 @@ def __init__(self, authority, tenant_id=None, client_id=None, encrypt=False, use
6969
self.client_id = client_id or AZURE_CLI_CLIENT_ID
7070
self._encrypt = encrypt
7171
self._use_msal_http_cache = use_msal_http_cache
72-
self._allow_broker = allow_broker
72+
self._enable_broker_on_windows = enable_broker_on_windows
7373
self._instance_discovery = instance_discovery
7474

7575
# Build the authority in MSAL style
@@ -107,8 +107,8 @@ def _msal_app_kwargs(self):
107107
@property
108108
def _msal_public_app_kwargs(self):
109109
"""kwargs for creating PublicClientApplication."""
110-
# allow_broker can only be used on PublicClientApplication.
111-
return {**self._msal_app_kwargs, "allow_broker": self._allow_broker}
110+
# enable_broker_on_windows can only be used on PublicClientApplication.
111+
return {**self._msal_app_kwargs, "enable_broker_on_windows": self._enable_broker_on_windows}
112112

113113
@property
114114
def _msal_app(self):

src/azure-cli-core/azure/cli/core/auth/landing_pages/success.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ <h3>Announcements</h3>
2525
<p>[Windows only] Azure CLI is collecting feedback on using the <a href="https://learn.microsoft.com/windows/uwp/security/web-account-manager">Web Account Manager</a> (WAM) broker for the login experience.</p>
2626
<p>You may opt-in to use WAM by running the following commands:</p>
2727
<code>
28-
az config set core.allow_broker=true<br>
28+
az config set core.enable_broker_on_windows=true<br>
2929
az account clear<br>
3030
az login
3131
</code>

src/azure-cli-core/azure/cli/core/telemetry.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def __init__(self, correlation_id=None, application=None):
7070
self.suppress_new_event = False
7171
self.poll_start_time = None
7272
self.poll_end_time = None
73-
self.allow_broker = None
73+
self.enable_broker_on_windows = None
7474
self.msal_telemetry = None
7575
self.secrets_detected = None
7676
self.user_agent = None
@@ -221,7 +221,7 @@ def _get_azure_cli_properties(self):
221221
set_custom_properties(result, 'ShowSurveyMessage', str(self.show_survey_message))
222222
set_custom_properties(result, 'RegionInput', self.region_input)
223223
set_custom_properties(result, 'RegionIdentified', self.region_identified)
224-
set_custom_properties(result, 'AllowBroker', str(self.allow_broker))
224+
set_custom_properties(result, 'EnableBrokerOnWindows', str(self.enable_broker_on_windows))
225225
set_custom_properties(result, 'MsalTelemetry', self.msal_telemetry)
226226
set_custom_properties(result, 'SecretsWarning', _get_secrets_warning_config())
227227
set_custom_properties(result, 'SecretsDetected', self.secrets_detected)
@@ -462,9 +462,9 @@ def set_region_identified(region_input, region_identified):
462462

463463

464464
@decorators.suppress_all_exceptions()
465-
def set_broker_info(allow_broker):
466-
# whether customer has configured `allow_broker` to enable WAM(Web Account Manager) login for authentication
467-
_session.allow_broker = allow_broker
465+
def set_broker_info(enable_broker_on_windows):
466+
# Log the value of `enable_broker_on_windows`
467+
_session.enable_broker_on_windows = enable_broker_on_windows
468468

469469

470470
@decorators.suppress_all_exceptions()

0 commit comments

Comments
 (0)