Skip to content
Merged
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
4 changes: 3 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 @@ -112,7 +112,9 @@ def _msal_app_kwargs(self):
def _msal_public_app_kwargs(self):
"""kwargs for creating PublicClientApplication."""
# enable_broker_on_windows can only be used on PublicClientApplication.
return {**self._msal_app_kwargs, "enable_broker_on_windows": self._enable_broker_on_windows}
return {**self._msal_app_kwargs,
"enable_broker_on_windows": self._enable_broker_on_windows,
"enable_pii_log": True}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May I know why not adding this to _msal_app_kwargs?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enable_pii_log only affects the WAM flow from PublicClientApplication:

If adding enable_pii_log to _msal_app_kwargs, it will be passed to ConfidentialClientApplication which doesn't support WAM at all.

https://github.com/AzureAD/microsoft-authentication-library-for-python/blob/30dce4ecc63d93ef34b89c052aab1a1231395ce6/msal/application.py#L660

        self._decide_broker(allow_broker, enable_pii_log)

https://github.com/AzureAD/microsoft-authentication-library-for-python/blob/30dce4ecc63d93ef34b89c052aab1a1231395ce6/msal/application.py#L675-L676

    def _decide_broker(self, allow_broker, enable_pii_log):
        is_confidential_app = self.client_credential or isinstance(
            self, ConfidentialClientApplication)
        if is_confidential_app and allow_broker:
            raise ValueError("allow_broker=True is only supported in PublicClientApplication")


@property
def _msal_app(self):
Expand Down