{Core} Only apply allow_broker to PublicClientApplication - #26482
Merged
Conversation
️✔️AzureCLI-FullTest
|
|
Validation for Breaking Change Starting...
Thanks for your contribution! |
Collaborator
|
Core |
|
|
||
| def get_user_credential(self, username): | ||
| return UserCredential(self.client_id, username, **self._msal_app_kwargs) | ||
| return UserCredential(self.client_id, username, **self._msal_public_app_kwargs) |
Contributor
Author
There was a problem hiding this comment.
We have no way of knowing whether device code flow is used in the initial az login. If so, and then we set allow_broker for UserCredential, token refreshing will fail (AzureAD/microsoft-authentication-library-for-python#563).
Contributor
There was a problem hiding this comment.
FYI: We have a solution now. This MSAL PR will fix the device code flow problem. Feel free to test it out
This was referenced Oct 31, 2023
Jiashuo Li (jiasli)
marked this pull request as ready for review
November 1, 2023 08:06
Jiashuo Li (jiasli)
requested review from
Zhiyi Huang (calvinhzy) and
Yishi Wang (evelyn-ys)
as code owners
November 1, 2023 08:06
Yishi Wang (evelyn-ys)
approved these changes
Nov 2, 2023
Hang (bebound)
approved these changes
Nov 3, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related command
az loginDescription
Close #26052
Turn on WAM with
Then use service principal to login with
az login --service-principal -u {} -p {} -t {}. The command fails withValueError: allow_broker=True is only supported in PublicClientApplication.This is because WAM doesn't support service principal. This issue has also been reported to the MSAL repo: AzureAD/microsoft-authentication-library-for-python#544
This PR changes the behavior by only applying
allow_brokertoPublicClientApplication, not toConfidentialClientApplication.Testing Guide
Observe the
az logincommand succeed without raising any exception.