AzureCLIV1 with variable values containing %X
See original GitHub issueAzureCLIV1
When a variable value used in the inline script, contains %X it results in weird output.
Required Information
Entering this information will route you directly to the right team and expedite traction.
Question, Bug, or Feature?
Type: Bug
Enter Task Name: AzureCLIV1
Environment
-
Server - Azure Pipelines or TFS on-premises?
- If using Azure Pipelines, provide the account name, team project name, build definition name/build number:
- uniun
- uniun
- Uniun Website : 0.12.3-2-master
- If using Azure Pipelines, provide the account name, team project name, build definition name/build number:
-
Agent - Hosted or Private:
- If using Hosted agent, provide agent queue name: windows-latest
Issue Description
I use this task in a classing Release pipeline with the following inline script:
az webapp config appsettings set --name foo --resource-group foo --slot-settings Foo="$(foo)"
Bar="$(bar)"
There are two variables there (I actually use a lot more but I have shortened for brevity).
When the value of $(foo) contains %X I see weird output. So suppose the value of $(foo) is “Hi%X” I then see this as the final az cli call being made:
az webapp config appsettings set --name foo --resource-group foo --slot-settings Foo="HiOTHER VARIABLE VALUES HERE"
In this case the value I am setting is a password, so it does contain symbols and in this case it happens to contain %X which is breaking the script.
Task logs
[Enable debug logging and please provide the zip file containing all the logs for a speedy resolution]
Troubleshooting
Checkout how to troubleshoot failures and collect debug logs: https://docs.microsoft.com/en-us/vsts/build-release/actions/troubleshooting
Error logs
[Insert error from the logs here for a quick overview]
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (3 by maintainers)
@dazinator AzureCLIV1 uses batch files, so to escape them you can follow esacping guidelines for batch. I found this link useful for escaping batch files. For escaping % you need to give %%. You can also use AzureCLIV2 that supports various scripting languages. There also you will need to escape based on the language selected
I’ll create a new issue.