Skip to content

az login still logged in successfully with wrong password in v2.5 #27441

Description

@NTHieu95

Describe the bug

I was expecting an error when I tried to do these steps:

  • use azure cli v2.52
  • run az login --service-principal --username <usrname> --password <pwd> --tenant <tenantname>
  • run the above command again but with a wrong password

Expected: cannot log in

Actual: still be able to login with the wrong password

After finding around, i found out that in v2.52, it saves your logged in account in this az account show command. After run this command:
az account clear
And then run the login command with the wrong password, then it would meet my expectation. (I used to use az cli v2.3 and this never happened back then)

My main question is: is this considered a bug? And what other option for login do I have to use to make it fail at the second time logging in?

Related command

Az login, az account

Errors

Az login still be able to login with wrong password

Issue script & Debug output

NA

Expected behavior

Cannot login at 2nd attemp

Environment Summary

Azure cli 2.52

Additional context

No response

Metadata

Metadata

Assignees

Labels

ARMaz resource/group/lock/tag/deployment/policy/managementapp/account management-groupAccountaz login/accountAuto-AssignAuto assign by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions