diff --git a/src/azure-cli-core/azure/cli/core/_profile.py b/src/azure-cli-core/azure/cli/core/_profile.py index df497e7af59..58aa33340b4 100644 --- a/src/azure-cli-core/azure/cli/core/_profile.py +++ b/src/azure-cli-core/azure/cli/core/_profile.py @@ -858,6 +858,8 @@ def _create_identity_instance(cli_ctx, *args, **kwargs): # PREVIEW: On Windows, use core.allow_broker=true to use broker (WAM) for authentication. allow_broker = cli_ctx.config.getboolean('core', 'allow_broker', fallback=False) + from .telemetry import set_broker_info + set_broker_info(allow_broker=allow_broker) return Identity(*args, encrypt=encrypt, use_msal_http_cache=use_msal_http_cache, allow_broker=allow_broker, **kwargs) diff --git a/src/azure-cli-core/azure/cli/core/telemetry.py b/src/azure-cli-core/azure/cli/core/telemetry.py index 1416a7d5ffd..b6359f04f91 100644 --- a/src/azure-cli-core/azure/cli/core/telemetry.py +++ b/src/azure-cli-core/azure/cli/core/telemetry.py @@ -67,6 +67,7 @@ def __init__(self, correlation_id=None, application=None): self.suppress_new_event = False self.poll_start_time = None self.poll_end_time = None + self.allow_broker = None def add_event(self, name, properties): for key in self.instrumentation_key: @@ -206,6 +207,7 @@ def _get_azure_cli_properties(self): set_custom_properties(result, 'PollEndTime', str(self.poll_end_time)) set_custom_properties(result, 'CloudName', _get_cloud_name()) set_custom_properties(result, 'ShowSurveyMessage', str(self.show_survey_message)) + set_custom_properties(result, 'AllowBroker', str(self.allow_broker)) return result @@ -425,6 +427,12 @@ def set_survey_info(show_survey_message): _session.show_survey_message = show_survey_message +@decorators.suppress_all_exceptions() +def set_broker_info(allow_broker): + # whether customer has configured `allow_broker` to enable WAM(Web Account Manager) login for authentication + _session.allow_broker = allow_broker + + @decorators.suppress_all_exceptions() def add_dedicated_instrumentation_key(dedicated_instrumentation_key): if not dedicated_instrumentation_key: