Skip to content

Incorrect arguments parsing when - is the first character #19644

@manuelserradev

Description

@manuelserradev

Describe the bug

Incorrect args parsing when arg value contains - as first character, for example -value.

Command Name

az functionapp keys set --key-value "-asd"
#                                    ^ incriminated

Errors:

az functionapp keys set --key-value -KeyValue --key-name -KeyName --name test-function-abc --resource-group test-rg --key-type functionKeys
argument --key-value: expected one argument

# Or in arg key-name

az functionapp keys set --key-value KeyValue --key-name -KeyName --name test-function-abc --resource-group test-rg --key-type functionKeys
argument --key-name: expected one argument

# With "escaped" values

az functionapp keys set --key-value "-KeyValue" --key-name "-KeyName" --name test-function-abc --resource-group test-rg --key-type functionKeys
argument --key-value: expected one argument

To Reproduce:

  • Create a function app named test-function on resource-group test-rg
    • For reference a Node.js runtime was selected in westeurope
  • Run one of the command above (eg. key-value or key-name must include an arg value with -Something)

Expected Behavior

An Host Key should be succesfully created with the provided correct -Something value.

Environment Summary

Linux-5.10.43.3-microsoft-standard-WSL2-x86_64-with-debian-bullseye-sid, Ubuntu 20.04.3 LTS
Python 3.6.10
Installer: DEB

azure-cli 2.28.0

Additional Context

The same happen when using az functionapp function keys set.

az functionapp function keys set --key-name "-KeyName" --key-value "-KeyValue" --function-name test-fn-http --name test-function-abc --resource-group test-rg
argument --key-name: expected one argument

There is not problem with - in the middle of the arg value, for example:

az functionapp function keys set --key-name "Key-Name" --key-value "Key-Value" --function-name test-fn-http --name test-function-abc --resource-group test-rg
Location     Name      ResourceGroup    Value
-----------  --------  ---------------  ---------
West Europe  Key-Name  test-rg          Key-Value

Metadata

Metadata

Assignees

Labels

Functionsaz functionappService AttentionThis issue is responsible by Azure service team.act-observability-squadcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions