When I run Connect-AzAccount my default browser set on windows OS(Chrome) is not running. But instead it is loading IE and asking for login details. How to change the browser ?
The pop-up window is not the default browser, only az login is used to log in through the browser.
In az login, if you want to log in in any browser, log in through az login --use-device-code.

In Connect-AzAccount, the page opened by default is still the powershell tool, it is not a browser, the following gif can be clearly seen in the task manager.
Step 1. Run Connect-AzAccount in powershell.

Step 2. Check Task Manager.

You can login azure without browser by
Connect-AzAccount -Credential $Credential -Tenant $tenant -Subscription $subscription
For more details, you can refer to the post.
Connect-AzAccount - how to avoid azure device authentication?
At my company, we use MFA for our Azure AD account. Additionally, our local AD is not integrated with Azure AD. And to make it more challenging, we use our local AD account ([email protected]) to authenticate to Azure DevOps while we use our Azure AD account ([email protected]) to authenticate to the Azure Resource Manager API.
Every time that I tried to authenticate with my Azure AD account ([email protected]) in PowerShell with Connect-AzAccount, it would authenticate as with my local AD account ([email protected]), instead.
I tried the usual commands to no avail:
Disconnect-AzAccount
Clear-AzContext -Scope CurrentUser -Force
Disable-AzContextAutosave -Scope Process
I tried nuking the history in Internet Explorer, but no dice.
I changed the default browser on my laptop from Chrome to Edge, and I nuked the history in Edge. No impact. PowerShell seemed to still be using its same engine for managing the interactive Azure login page regardless of what the OS is using for the default browser.
I researched how to change the browser used by PowerShell to manage the interactive Azure login page (Connect-AzAccount) to work around the problem. But I didn't have any luck finding a solution.
Here's what ultimately worked in my scenario:
Disconnect-AzAccount
Connect-AzAccount -UseDeviceAuthentication
When you use the -UseDeviceAuthentication option, Connect-AzAccount lets you manually pick which browser you want to use for Azure authentication.
In my case, I used Chrome in incognito mode to perform Azure authentication, and I was finally able to authenticate with my Azure AD account ("[email protected]") successfully.
Although this doesn't change the default browser used by Connect-AzAccount, it's a work-around to let you manually choose a different browser for Azure authentication.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With