Azure DevOps pipelines & in parameters - do they need to be escaped and how?

How can I escape & in a script argument or variable in devops pipeline?

Upvotes: 0

Views: 546

Answers (1)

Felix
Felix

Reputation: 1162

What do you mean 'escape &'? In the azure devops pipeline variable, we do not need to escape &, we can just use it in the variables and output it:

variables:
- name: Test_For_ABC
  value: ABC'\&'fasd

stages:
  - stage: A
    variables:
    - group: cmt
    jobs:
      - job: A1
        steps:
        - task: PowerShell@2
          inputs:
            targetType: 'inline'
            script: |
              Write-Host "$(dockerhubuser)"
              Write-Host "$(Test_For_ABC)"

enter image description here

Upvotes: 1

Related Questions