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
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.
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
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