Skip to content

Commit

Permalink
polish some well known unfriendly AAD server errors (#962)
Browse files Browse the repository at this point in the history
  • Loading branch information
yugangw-msft authored Sep 23, 2016
1 parent d9a9972 commit 777a33d
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ def login(username=None, password=None, service_principal=None, tenant=None):
service_principal,
tenant)
except AdalError as err:
#try polish unfriendly server errors
if username:
msg = str(err)
suggestion = "For cross-check, try 'az login' to authenticate through browser"
if ('ID3242:' in msg) or ('Server returned an unknown AccountType' in msg):
raise CLIError("The user name might be invalid. " + suggestion)
if 'Server returned error in RSTR - ErrorCode' in msg:
raise CLIError("Logging in through command line is not supported. " + suggestion)
raise CLIError(err)
return list(subscriptions)

Expand Down

0 comments on commit 777a33d

Please sign in to comment.