Azure-cli: az login fails with Azure AD service principal and certain client secrets.

Created on 9 Feb 2020  路  3Comments  路  Source: Azure/azure-cli

When attempting to login using az cli using Azure AD service princiapal, certain client secrets are causing errors.

Here's an example of a client secret that failed and the error message.

az login --service-principal --username --password "-6fkdUrc:x-]M63JPPosVWJS47cWiiUX" --tenant

ERROR: az login: error: argument --password/-p: expected one argument
usage: az login [-h] [--verbose] [--debug]
[--output {json,jsonc,table,tsv,yaml,none}] [--query JMESPATH]
[--username USERNAME] [--password PASSWORD]
[--service-principal] [--tenant TENANT]
[--allow-no-subscriptions] [-i] [--use-device-code]
[--use-cert-sn-issuer]

Seems like an issue with the format of the password. I tried the password, enclosing in single-quotes, double-quotes and no-quotes and resulted in the same error message.

Account customer-response-expected

Most helpful comment

@krishjag , this is a known issue in python that the leading character '-' will confusing the argument parser to make it as an option name. https://github.com/Azure/azure-cli/issues/7054 . You can fix this issue by adding '=' between the option name and value : az login --username=$azureUserName --password=$azurePassword

All 3 comments

Hi @jiasli , could you please help with this ?

add to S166.

@krishjag , this is a known issue in python that the leading character '-' will confusing the argument parser to make it as an option name. https://github.com/Azure/azure-cli/issues/7054 . You can fix this issue by adding '=' between the option name and value : az login --username=$azureUserName --password=$azurePassword

Was this page helpful?
0 / 5 - 0 ratings