azure-cliwindows-11azure-authenticationazureclicredential

Switch az login from Windows Account Manager back to Web Access manager


Does any know what the detailed process is to switch between the Windows Account Manager and WAM for logging into the az cli?

Windows 11 has (what I believe to be called) a Windows Account Manager in the Settings app. It is possible to add multiple accounts used by other apps. I have seen the limit is 4 accounts can be added.

There is a feature in the az cli that allows users to select an account from at max 4 registered in this Windows setting. I used this feature once before and was unable to switch back to the Web Account Manager (WAM) for the az cli and would like to understand what the process is to switch between them.

enter image description here

When logging into Azure with the WAM using the az cli, you will get this confirmation screen once your login is completed.

enter image description here


Solution

  • I used this feature once before and was unable to switch back to the Web Account Manager (WAM) for the az cli and would like to understand what the process is to switch between them.

    To switch from Windows Account Manager to Web Account Manager in PowerShell, here are the steps.

    1. If you run the below command the default authentication goes to Windows Account Manager

    Note: If the value set to True, it indicates Windows-based authentication, which is registered in Windows Local Accounts

      az config set core.allow_broker=true  
         az account clear  
         az login
    

    Output of above command:

    enter image description here

    1. Even if you set the authentication to Windows Account Manager, you can still log in with Web-Based Authentication by using --use-device-code.
       az login --use-device-code
    

    Output of above command:

    enter image description here

    1. If you want to permanently change the default authentication to web account manager, set the value to false.
    az config set core.allow_broker=false 
    az account clear 
    az login
    

    Output of above command:

    enter image description here