'Azure workspace opens browser even when using "use-device-code" flag

I'm trying to use the Azure CLI az login to connect to my workspace. I want to use the --use-device-code flag so I can use my secure work laptop to enter the code. The problem is that even when I use this flag, my browser is opened with the Microsoft login screen when I run the Workspace.from_config command (yes the config.json file is in the correct directory). This happens for me both on my Ubuntu and Windows installation. When I try running it interactively through the Azure CLI docker image, it does seem to work however. Is there anyone that could point me in the right direction?



Solution 1:[1]

I want to use the --use-device-code flag so I can use my secure work laptop to enter the code. The problem is that even when I use this flag, my browser is opened with the Microsoft login screen when I run the Workspace.from_config

There are different ways to login with azure account by using cli, To not get the Microsoft login screen pop-up you can try the below cmdlt

az login --username azureusername --password azurepassword

Because when we use device code it will ask for entering the code and login as shown here;

az login --use-device-code
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code ‘DeviceCode’ to authenticate.

For more information please refer this Blogpost .

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 AjayKumarGhose-MT