az container create environment variables does not parse values with ampersand correctly #5573
Labels
Container
Infrastructure
question
The issue doesn't require a change to the product in order to be resolved. Most issues start as that
I am attempting to pass in environment variables to az container create command. When a value has an ampersand contained within it, the environment variables cut out the remainder of the value and subsequent key/values that follow.
Environment
Powershell 5.1.16299.98
Azure Client 2.0 (https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest)
Powershell script
az container create
--resource-group <resourceGroup>
--name
--image <image>
--cpu 1
--memory 1
--registry-password
--ip-address public
--ports `
--environment-variables Key1="value1&value2" Key2=value3
Current output
"containers": [
{
"command": null,
"environmentVariables": [
{
"name": "Key1",
"value": "value1"
}
]
..
Expected output
"containers": [
{
"command": null,
"environmentVariables": [
{
"name": "Key1",
"value": "value1&value2"
},
{
"name": "Key2",
"value": "value3"
},
]
..
Update #1
Also in the current output is the following error message, I presume due to again how it's parsing.
'Value2' is not recognized as an internal or external command,
operable program or batch file.
Do I need to escape the string somehow?
update 2
When running in interactive mode (without the "`" line breaks") the environment variables run as expected. I tried removing the line breaks in powershell just the same but am presented with the same error.
update 3
works in normal command prompt, issue appears restricted to powershell
The text was updated successfully, but these errors were encountered: