FYI: Azure CLI “More than one token matches the criteria. The result is ambiguous.”

If you are getting this error when using the Azure CLI commands:

And you run the command with the --debug switch you see something along these lines (the exact path could vary – below is from macOS M1):

Try doing an az account clear and then logging in again. That helped me today.

I have a couple of Azure accounts and use two functions like these in my .bash_profile to switch between work and personal accounts:

I guess something messed up somewhere and hence these ambiguous errors.