azure-devops-cli-extension
azure-devops-cli-extension copied to clipboard
'az pipelines variable update' fails on special characters (^, >)
Describe the bug
az pipelines variable update has difficulties dealing with some special characters:
works
$key="semver"
$value="~1.0.0"
az pipelines variable update --project $projectName --pipeline-name $pipelineName --name --value $key $value
errors
$key="semver"
$value="^1.0.0" # caret (^) will be ignored in the UI frontend
$value=">=1.0.0" # error: (>) leads to an error
az pipelines variable update --project $projectName --pipeline-name $pipelineName --name --value $key $value
Environment Summary
Windows-10-10.0.19041-SP0
Python 3.6.6
Installer: MSI
azure-cli 2.3.1
Extensions:
aks-preview 0.4.66
azure-devops 0.18.0
azure-iot 0.9.3
storage-preview 0.2.12
I ran into this today when using the az cli with PowerShell.
I was able to work around it by enclosing the value string in double quotes inside of single quotes. eg '"value"'
Hope this helps anyone who runs into the same issue.
Example Usage
az pipelines variable-group variable update --group-id $variableGroupId --name $variableName --secret true --project $azureDevOpsProject --org $azureDevOpsOrganisationUrl --value '"ValueWithSpecialChars~^>*@"'