Azure / azure-cli

Azure Command-Line Interface
MIT License
4.03k stars 3k forks source link

UnrecognizedArgumentError in Azure Cloud Shell while parsing wildcard argument #16879

Open avanigupta opened 3 years ago

avanigupta commented 3 years ago

az feedback auto-generates most of the information requested below, as of CLI version 2.0.62

Describe the bug

Providing wildcard character as argument throws a strange error in Azure Cloud Shell (both powershell and bash shells). This only happens in Cloud Shell. I'm not sure which CLI version introduced this regression, but we had a customer report this error recently in this github issue.

To Reproduce

az appconfig kv list -n test-appconfig-00 --key * UnrecognizedArgumentError: unrecognized arguments: test.json Try this: 'az appconfig kv list --label <test,prod,\0> --name ' Still stuck? Run 'az --help' to view all commands or go to 'https://aka.ms/cli_ref' to learn more

Commands that still parse wildcard as expected:

az appconfig kv list -n test-appconfig-00 --key *abc []

az appconfig kv list -n test-appconfig-00 --key abc* []

Workaround for parsing wildcard:

az appconfig kv list -n test-appconfig-00 --key "*" []

Expected behavior

Many AppConfig commands accept wildcard characters as input arguments. Parsing * without quotes should not throw any error.

Environment summary

az --version azure-cli 2.18.0 *

core 2.18.0 * telemetry 1.0.6

Extensions: ai-examples 0.2.5 azure-cli-ml 1.20.0

Python location '/opt/az/bin/python3' Extensions directory '/home/avani/.azure/cliextensions' Extensions system directory '/opt/az/lib/python3.6/site-packages/azure-cli-extensions'

Python (Linux) 3.6.10 (default, Jan 15 2021, 09:54:35) [GCC 8.3.0]

Additional context

ghost commented 3 years ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @shenmuxiaosen, @avanigupta.

Issue Details
> ### `az feedback` auto-generates most of the information requested below, as of CLI version 2.0.62 **Describe the bug** Providing wildcard character as argument throws a strange error in Azure Cloud Shell (both powershell and bash shells). This only happens in Cloud Shell. I'm not sure which CLI version introduced this regression, but we had a customer report this error recently in [this github issue](https://github.com/Azure/AppConfiguration/issues/48#issuecomment-776157045). **To Reproduce** `az appconfig kv list -n test-appconfig-00 --key *` UnrecognizedArgumentError: unrecognized arguments: test.json Try this: 'az appconfig kv list --label --name ' Still stuck? Run 'az --help' to view all commands or go to 'https://aka.ms/cli_ref' to learn more **Commands that still parse wildcard as expected:** `az appconfig kv list -n test-appconfig-00 --key *abc` [] `az appconfig kv list -n test-appconfig-00 --key abc*` [] **Workaround for parsing wildcard:** `az appconfig kv list -n test-appconfig-00 --key "*"` [] **Expected behavior** Many AppConfig commands accept wildcard characters as input arguments. Parsing `*` without quotes should not throw any error. **Environment summary** `az --version` azure-cli 2.18.0 * core 2.18.0 * telemetry 1.0.6 Extensions: ai-examples 0.2.5 azure-cli-ml 1.20.0 Python location '/opt/az/bin/python3' Extensions directory '/home/avani/.azure/cliextensions' Extensions system directory '/opt/az/lib/python3.6/site-packages/azure-cli-extensions' Python (Linux) 3.6.10 (default, Jan 15 2021, 09:54:35) [GCC 8.3.0] **Additional context**
Author: avanigupta
Assignees: -
Labels: `App Configuration`, `Service Attention`, `needs-triage`
Milestone: -
yonzhan commented 3 years ago

appconfig

ghost commented 3 years ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @maertendMSFT.

Issue Details
> ### `az feedback` auto-generates most of the information requested below, as of CLI version 2.0.62 **Describe the bug** Providing wildcard character as argument throws a strange error in Azure Cloud Shell (both powershell and bash shells). This only happens in Cloud Shell. I'm not sure which CLI version introduced this regression, but we had a customer report this error recently in [this github issue](https://github.com/Azure/AppConfiguration/issues/48#issuecomment-776157045). **To Reproduce** `az appconfig kv list -n test-appconfig-00 --key *` UnrecognizedArgumentError: unrecognized arguments: test.json Try this: 'az appconfig kv list --label --name ' Still stuck? Run 'az --help' to view all commands or go to 'https://aka.ms/cli_ref' to learn more **Commands that still parse wildcard as expected:** `az appconfig kv list -n test-appconfig-00 --key *abc` [] `az appconfig kv list -n test-appconfig-00 --key abc*` [] **Workaround for parsing wildcard:** `az appconfig kv list -n test-appconfig-00 --key "*"` [] **Expected behavior** Many AppConfig commands accept wildcard characters as input arguments. Parsing `*` without quotes should not throw any error. **Environment summary** `az --version` azure-cli 2.18.0 * core 2.18.0 * telemetry 1.0.6 Extensions: ai-examples 0.2.5 azure-cli-ml 1.20.0 Python location '/opt/az/bin/python3' Extensions directory '/home/avani/.azure/cliextensions' Extensions system directory '/opt/az/lib/python3.6/site-packages/azure-cli-extensions' Python (Linux) 3.6.10 (default, Jan 15 2021, 09:54:35) [GCC 8.3.0] **Additional context**
Author: avanigupta
Assignees: -
Labels: `App Configuration`, `Cloud Shell`, `Service Attention`
Milestone: -
avanigupta commented 3 years ago

This issue is not confined to AppConfig module. Other commands also fail on Cloud Shell with the same error when * is supplied as an argument. This error is thrown before any argument validation logic of the command module is invoked:

az keyvault secret list --id * UnrecognizedArgumentError: unrecognized arguments: test.json Try this: 'az keyvault secret list --maxresults <{maxresults}> --vault-name ' Still stuck? Run 'az --help' to view all commands or go to 'https://aka.ms/cli_ref' to learn more

az storage account list -g * UnrecognizedArgumentError: unrecognized arguments: test.json Try this: 'az storage account list --resource-group ' Still stuck? Run 'az --help' to view all commands or go to 'https://aka.ms/cli_ref' to learn more

avanigupta commented 3 years ago

@maertendMSFT , any update on this behavior in Cloud Shell? It's not an AppConfig issue - this is common for all commands run on Cloud Shell.