-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Profile] BREAKING CHANGE: az login
: --password
no longer accepts service principal certificate
#30092
Conversation
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
az login refinement |
400c6c9
to
c9328ce
Compare
58e01df
to
521ca74
Compare
@@ -196,7 +192,7 @@ def login_with_service_principal(self, client_id, credential, scopes): | |||
""" | |||
sp_auth = ServicePrincipalAuth.build_from_credential(self.tenant_id, client_id, credential) | |||
client_credential = sp_auth.get_msal_client_credential() | |||
cca = ConfidentialClientApplication(client_id, client_credential, **self._msal_app_kwargs) | |||
cca = ConfidentialClientApplication(client_id, client_credential=client_credential, **self._msal_app_kwargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ConfidentialClientApplication
's client_credential
is a keyword argument. #29439 passes a positional argument, breaking tests such as azure.cli.core.auth.tests.test_identity.TestIdentity.test_login_with_service_principal_certificate
.
Also see Azure/azure-cli-dev-tools#318
@@ -318,20 +318,13 @@ def build_credential(cls, secret_or_certificate=None, | |||
} | |||
""" | |||
entry = {} | |||
if certificate: | |||
if client_secret: | |||
logger.warning(PASSWORD_CERTIFICATE_WARNING) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the os.path.isfile()
detection logic is removed, it is no longer possible to know if client_secret
is a certificate, so the warning is now unconditionally shown when --password
is used.
The warnings are kept but rephrased:
They will be removed after several releases. We followed this pattern during Microsoft Graph migration: |
# secret with '~', which is preserved as-is | ||
cred = ServicePrincipalAuth.build_credential(secret_or_certificate="~test_secret") | ||
assert cred == {"client_secret": "~test_secret"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The secret is no longer expanded, so this check is meaningless.
# we let the user explicitly log in to AAD with MSAL. | ||
"Please explicitly log in with:\n{}" if error.get('error') == 'broker_error' | ||
else "Interactive authentication is needed. Please run:\n{}").format(login_command) | ||
if error_codes and 7000215 in error_codes: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the full message of 7000215?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is in the PR description:
AADSTS7000215: Invalid client secret provided. Ensure the secret being sent in the request is the client secret value, not the client secret ID, for a secret added to app 'dd5baa90-0c41-4cab-a458-e8c33d3249bb'.
… service principal certificate (Azure#30092)
Related command
Description
Fix #28839
Follow up work on #30091
--password
no longer accepts service principal certificate.Testing Guide
History Notes
[Profile] BREAKING CHANGE:
az login
:--password
no longer accepts a service principal certificate. Use--certificate
to pass a service principal certificate