File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
src/azure-cli-core/azure/cli/core/auth Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -43,11 +43,13 @@ def aad_error_handler(error, **kwargs):
4343 recommendation = PASSWORD_CERTIFICATE_WARNING
4444 else :
4545 login_command = _generate_login_command (** kwargs )
46- recommendation = (
47- # Cloud Shell uses IMDS-like interface for implicit login. If getting token/cert failed,
48- # we let the user explicitly log in to AAD with MSAL.
49- "Please explicitly log in with:\n {}" if error .get ('error' ) == 'broker_error'
50- else "Interactive authentication is needed. Please run:\n {}" ).format (login_command )
46+ recommendation = None
47+ if login_command :
48+ recommendation = (
49+ # Cloud Shell uses IMDS-like interface for implicit login. If getting token/cert failed,
50+ # we let the user explicitly log in to AAD with MSAL.
51+ "Please explicitly log in with:\n {}" if error .get ('error' ) == 'broker_error'
52+ else "Interactive authentication is needed. Please run:\n {}" ).format (login_command )
5153
5254 from azure .cli .core .azclierror import AuthenticationError
5355 raise AuthenticationError (error_description , msal_error = error , recommendation = recommendation )
@@ -56,6 +58,9 @@ def aad_error_handler(error, **kwargs):
5658def _generate_login_command (scopes = None , claims_challenge = None ):
5759 login_command = ['az login' ]
5860
61+ if not scopes and not claims_challenge :
62+ return None
63+
5964 # Rejected by Conditional Access policy, like MFA
6065 if scopes :
6166 login_command .append ('--scope {}' .format (' ' .join (scopes )))
You can’t perform that action at this time.
0 commit comments