From d397b01907de441bdda4eeb76fe6f4b46fa864dc Mon Sep 17 00:00:00 2001 From: jiasli <4003950+jiasli@users.noreply.github.com> Date: Mon, 30 Jun 2025 15:49:38 +0800 Subject: [PATCH] ssh --- src/ssh/azext_ssh/custom.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ssh/azext_ssh/custom.py b/src/ssh/azext_ssh/custom.py index 13baf9e3388..70c6a31df24 100644 --- a/src/ssh/azext_ssh/custom.py +++ b/src/ssh/azext_ssh/custom.py @@ -222,12 +222,14 @@ def _get_and_write_certificate(cmd, public_key_file, cert_file, ssh_client_folde profile = Profile(cli_ctx=cmd.cli_ctx) t0 = time.time() - # We currently are using the presence of get_msal_token to detect if we are running on an older azure cli client - # TODO: Remove when adal has been deprecated for a while + # Azure CLI 2.76 brought back get_msal_token as the official interface for getting certificate: + # https://github.com/Azure/azure-cli/pull/31082 if hasattr(profile, "get_msal_token"): # we used to use the username from the token but now we throw it away _, certificate = profile.get_msal_token(scopes, data) else: + # Azure CLI 2.76 dropped `data` from get_token: https://github.com/Azure/azure-cli/pull/31723 + # TODO: Remove when Azure CLI <= 2.75 has been deprecated for a while credential, _, _ = profile.get_login_credentials(subscription_id=profile.get_subscription()["id"]) certificatedata = credential.get_token(*scopes, data=data) certificate = certificatedata.token