{Auth} Support get_token_info protocol#30928
Conversation
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
| return None | ||
|
|
||
|
|
||
| def _generate_msal_kwargs(options=None): |
There was a problem hiding this comment.
Unifying the msal_kwargs generation logic also fixes the claims argument for get_token (#30062 (comment)).
| # For VM SSH. 'data' support is a CLI-specific extension. | ||
| # SDK doesn't support 'data': https://github.com/Azure/azure-sdk-for-python/pull/16397 | ||
| if 'data' in options: | ||
| msal_kwargs['data'] = options['data'] |
There was a problem hiding this comment.
data is currently only officially used by ssh extension:
credential, _, _ = profile.get_login_credentials(subscription_id=profile.get_subscription()["id"])
certificatedata = credential.get_token(*scopes, data=data)| @@ -24,15 +24,24 @@ def __init__(self, credential, auxiliary_credentials=None): | |||
| self._auxiliary_credentials = auxiliary_credentials | |||
|
|
|||
| def get_token(self, *scopes, **kwargs): | |||
There was a problem hiding this comment.
get_token is kept as ssh extension still direclty uses it to get an SSH certificate:
credential, _, _ = profile.get_login_credentials(subscription_id=profile.get_subscription()["id"])
certificatedata = credential.get_token(*scopes, data=data)
certificate = certificatedata.token| return msal_kwargs | ||
|
|
||
|
|
||
| def _build_sdk_access_token_info(token_entry): |
There was a problem hiding this comment.
build_sdk_access_token is still used by azure.cli.core.auth.adal_authentication.MSIAuthenticationWrapper.get_token:
so it can't be moved to src/azure-cli-core/azure/cli/core/auth/credential_adaptor.py right now.
Related command
az loginDescription
Require #29955
Close #29967
Support the new
get_token_infoprotocol introduced byazure-core1.31.0 (Azure/azure-sdk-for-python#36565).azure-corewas bumped to 1.31.0 in #29944.