azure cli not able login using command line option
When your account is Microsoft account(such as *@outlook.com, *@hotmail.com), you will get the error log. The root reason is Microsoft account does not support non-interactive login. It is also unsafe for you to login Azure with your account directly.
If you plan to manage your app or service with Azure CLI 2.0, you should run it under an Azure Active Directory (AAD) service principal rather than your own credentials. Please refer to the following steps to create service principal.
1.Login to Azure.
2.Use az ad sp create-for-rbac to create the service principal.
az ad sp create-for-rbac --name {appId} --password "{strong password}"
Example
az ad sp create-for-rbac --name shuiexample --password "Password012!!"
You could get result like below:
{
"appId": "bca24913-026d-4020-b9f1-add600bf9045",
"displayName": "shuiexample1234",
"name": "http://shuiexample1234",
"password": "*******",
"tenant": "*******"
}
3.Sign in using the service principal using the following:
$appID="bca24913-026d-4020-b9f1-add600bf9045"
$password="******"
$tenant="*******"
az login --service-principal -u $appID --password $password --tenant $tenant
More information about this please refer to this link.