question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Character ```^``` missed in input parsing for az appconfig

See original GitHub issue

Describe the bug When we run CLI command in powershell, ^ is missed in input argument. For example, if --input is “a^b”, then it becomes “ab”. This issue only happens in powershell. After some verifications, character is drop in CLI input pipeline before service team’s code can reach it.

To Reproduce

$mypass = ‘hello^test’ az appconfig kv set -n ‘resource-name’ --key ‘myKey’ --value $mypass --yes -y

Expected behavior All characters should be preserved as input.

Environment summary CLI version: 2.26.0 Env: Powershell

Additional context

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jiaslicommented, Aug 31, 2021

Caused by

In Command Prompt, ^ in such case is interpreted as the the Escape Character which as no meaning before t:

C:\>echo hello^test
hellotest

See https://ss64.com/nt/syntax-esc.html

When calling az.cmd from PowerShell, please pay attention to PowerShell’s quoting rules: https://github.com/Azure/azure-cli/blob/dev/doc/quoting-issues-with-powershell.md.

You may surround the value with double quotes:

PS > az --debug '"hello^test"'
cli.knack.cli: Command arguments: ['--debug', 'hello^test']

Or prevent PowerShell from parsing quotes:

PS > az --% --debug "hello^test"
cli.knack.cli: Command arguments: ['--debug', 'hello^test']

Or repeat ^ 4 times:

PS > az --debug 'hello^^^^test'
cli.knack.cli: Command arguments: ['--debug', 'hello^test']

This causes the az.cmd script to receive hello^^test, and it passes hello^test to python.exe.

0reactions
shenmuxiaosencommented, Aug 30, 2021

@yonzhan Can you help to redirect to CLI framework folks who work on cli in powershell? This issue is not limit to az appconfig but all other commands.

Read more comments on GitHub >

github_iconTop Results From Across the Web

UnrecognizedArgumentError in Azure Cloud Shell while ...
Many AppConfig commands accept wildcard characters as input arguments. Parsing * without quotes should not throw any error.
Read more >
Tips for using the Azure CLI successfully - Microsoft Learn
The az command fails because it is missing the required --location parameter. The conditional statement finds that $? is false and writes an ......
Read more >
Infrastructure as Code - An intro - Part 2 - Using Azure CLI
The following tenants require Multi-Factor Authentication (MFA) Use 'az login –tenant TENANT_ID' to explicitly login to a tenant. The reason for ...
Read more >
How can I sent an Azure app config value that contains an ...
I'm using Azure CLI to try to set an app config value to this URL: az appconfig ...
Read more >
Manually create or edit the CloudWatch agent configuration file
Specifies the user-agent string that is used by the CloudWatch agent when it ... Allowed characters include a–z, A–Z, 0–9, '_' (underscore), '-'...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found