[Profile] BREAKING CHANGE: az login: --password no longer accepts service principal certificate#30092
[Profile] BREAKING CHANGE: az login: --password no longer accepts service principal certificate#30092
az login: --password no longer accepts service principal certificate#30092Conversation
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
|
az login refinement |
400c6c9 to
c9328ce
Compare
58e01df to
521ca74
Compare
| 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.
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
| entry = {} | ||
| if certificate: | ||
| if client_secret: | ||
| logger.warning(PASSWORD_CERTIFICATE_WARNING) |
There was a problem hiding this comment.
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.
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.
What's the full message of 7000215?
There was a problem hiding this comment.
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
--passwordno longer accepts service principal certificate.Testing Guide
History Notes
[Profile] BREAKING CHANGE:
az login:--passwordno longer accepts a service principal certificate. Use--certificateto pass a service principal certificate