Log in to Azure using the az login cmdlet with the service principal. Once you execute the az login cmdlet, it will prompt you to provide the Azure user name and password or Azure account credentials.
Table of Contents
syntax of az login
Below is the syntax of the az login command.
az loginaz login [--allow-no-subscriptions] [--identity] [--password] [--service-principal]
[--tenant] [--use-cert-sn-issuer] [--use-device-code] [--username]Examples of AZ login
Example-1
After executing the below command, It prompted me to enter the credentials and after entering the credentials and On successful login, it showed me the below pop-up with the successful log in message “You have logged into Microsoft Azure!”. Check out the below screen shot for your reference.
az login
Example-2
You can execute the script below to log in to Azure using the service principal.
$appID="ghj56789-067e-7890-h9k1-jdd6kk11bf1646"
$password="xyz"
$tenant="xxxxxxx"
az login --service-principal -u $appID --password $password --tenant $tenantYou may also like following the articles below
Conclusion
In this Azure article, we discussed the syntax and usage of the az login command with examples. Thanks for reading this article !!!

I am Rajkishore, and I am a Microsoft Certified IT Consultant. I have over 14 years of experience in Microsoft Azure and AWS, with good experience in Azure Functions, Storage, Virtual Machines, Logic Apps, PowerShell Commands, CLI Commands, Machine Learning, AI, Azure Cognitive Services, DevOps, etc. Not only that, I do have good real-time experience in designing and developing cloud-native data integrations on Azure or AWS, etc. I hope you will learn from these practical Azure tutorials. Read more.
