Azure CLI pipeline with dash password

Jeremy Carter November 12, 2022

When using the Azure CLI pipeline step (atlassian/azure-cli-run) we notice that service principals that have a generated password that starts with a dash (`-`) are not supported.

The CLI spits out an error stating that you must use a different CLI argument to support them. 

Eg calling this fails:

az login --service-principal -u <CLIENT_ID> -p <CLIENT_SECRET_WITH_HYPHEN> --tenant <TENANT_ID>

See:

azure-docs-cli/use-cli-effectively.md at leading-dash · jiasli/azure-docs-cli (github.com)

Add instruction for passing argument with leading dash by jiasli · Pull Request #2318 ·  MicrosoftDocs/azure-docs-cli (github.com)

`az login -u <username> -p <password>` does not work if <password> starts with a hyphen · Issue #15493 · Azure/azure-cli (github.com)

 

To fix this I am manually using the azure cli docker image and calling the CLI manually like this:

az login --service-principal -u=$AZURE_APP_ID -p=$AZURE_PASSWORD --tenant=$AZURE_TENANT_ID

Notice the 

-p=

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events