How to log in to the Azure account using Az CLI command in PowerShell?

PowerShellMicrosoft TechnologiesSoftware & Coding

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:
raja
Published on 31-Aug-2021 09:30:36

Advertisements