Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Log In to Azure Account Using AZ CLI Command in PowerShell



To login to the Azure account using Azure CLI, we need to use the az login command. Once you type the az login command, it will prompt for the Azure portal login console.

If you need to log in with the device authentication code in the browser, you need to use the parameter –use-device-code.

PS C:\> 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.

You need to open a website https://microsoft.com/devicelogin/ and have to enter a code. If you are not already connected with the Microsoft Azure portal, you need to log in first.

You can also provide the username and password in the command line as shown below.

PS C:\> az login --username azureusername --password azurepassword

If the password is not provided, it will prompt for the secret password.

PS C:\> az login --username azureuseraccount
Password:
Updated on: 2021-08-31T09:42:58+05:30

15K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements