Cause: The error occurs when the value of -u(--username) and/or -t(--tenant) parameter is incorrectly specified. "AZ Login" allows three kind of account to login to azure, which are:
- user account: The "-u" parameter should contain UPN of the user.
- service principal: The "-u" parameter should contain Application ID.
- managed system identity: The "-u" parameter should contain path of the managed identity, e.g., /subscriptions/<subscriptionId>/resourcegroups/myRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myID
Resolution: Correct syntax of the command for AZ Login via servicePrincipal is: az login --service-principal -u your_application_id -p your_client_secret --tenant your_tenant.onmicrosoft.com
Read more: