Skip to content

Conversation

@jiasli
Copy link
Member

@jiasli jiasli commented Nov 10, 2020

Description

_token_retriever is only available for AdalAuthentication which is designed for user or Service Principal credential. It is not available for Managed Identity credential MSIAuthenticationWrapper. Therefore, calling _token_retriever to retrieve a raw token will fail for Managed Identity credential:

# WRONG!!!
return Profile(cli_ctx=cli_ctx).get_login_credentials(resource)[0]._token_retriever()

This has already caused 2 buggy command module and extension: #15805, Azure/azure-cli-extensions#2461

This PR adds comments to prevent calling AdalAuthentication._token_retriever in the future by developers.

For more detail including correct ways to get a raw token, see #15805 (comment).

@yonzhan
Copy link
Collaborator

yonzhan commented Nov 10, 2020

Core

@yonzhan yonzhan added this to the S179 milestone Nov 10, 2020
@yonzhan yonzhan requested a review from evelyn-ys November 10, 2020 10:45
Copy link
Contributor

@arrownj arrownj left a comment

Choose a reason for hiding this comment

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

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants