Azure / Azure/azure-cli

az group deployment create seems to handle special characters poorly sometimes

Open
#18,392 6 comments 0 reactions 1 assignee Claimed by @zhoxing-ms View on GitHub
act-identity-squad ARM Customer Usage feature-request
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

## Describe the bug
(All usage of quotes below are as used in the actual commands run, except that obviously everything isn't surrounded by backticks.)
I was getting "Please provide string value for 'networkInterfaceId' (? for help):" when I invoked something of the form `az group deployment create [...] --parameters [...] adminPassword="123&QT;H,&blah" --networkInterfaceId "/a/valid/id"`, followed by printing `'QT' is not recognized as an internal or external command, operable program or batch file.
The system cannot find the file specified.`
When I poked around with --verbose, it printed among the config information right before that prompt+error "'adminPassword': {'value': '123'}", and noticed the QT in the string, which made me conclude that was probably the problem.

I don't think it's PowerShell mishandling it, because:
* doing `write-output [whole az cmdline]` prints each item on its own line, and that includes adminPassword=123&QT;H,&blah and networkInterfaceId=/a/valid/id, where I'd expect it to break apart as the az command does if it were PS's fault
* in addition, using `adminPassword='123&QT;H,&blah'` does not change the behavior at all, and I'm pretty confident that PS shouldn't be snooping inside single quotes.
* finally, that's not the PowerShell message for ye olde "bad command or file name", that's the error you get with cmd.

**Command Name**
`az group deployment create`

**Errors:**
```
`Please provide string value for 'networkInterfaceId' (? for help):`
[...]
`'QT' is not recognized as an internal or external command, operable program or batch file.
The system cannot find the file specified.`
```

## To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

- `az group deployment create --verbose -g {} -n {} --subscription {} --template-file {} --parameters {} {} adminPassword='123&QT;H,&blah' networkInterfaceId=/some/valid/id`

## Expected Behavior
As when I drop the special characters, a successful creation.

## Environment Summary
```
Windows-10-10.0.19041-SP0
Python 3.8.9
Installer: MSI

azure-cli 2.24.2

```
## Additional Context

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.