developer9969
developer9969

Reputation: 5236

Azure devops pipeline single quote and space in parameters

Dummy question may be but one thing that always confused me is the whether the space between {{}} should be there and also if the single quote should be there.

Are single quotes necessary?

'$(AzureConnectionName)'   VS $(AzureConnectionName)

Is the space required ?

'${{connectivity}}' VS  '${{ connectivity }}'

I know they are silly questions but could not find the answer.

Thanks

Upvotes: 0

Views: 4092

Answers (1)

Walter
Walter

Reputation: 3058

Are single quotes necessary?

If you use some special characters in your parameters, the output may be different. For example, here is my YAML configuration:

parameters:
- name: test
  default: test&
  type: string

steps:
- script: echo '${{ parameters.test }}' 
- script: echo ${{ parameters.test }}   
- pwsh: echo '${{ parameters.test }}'   
- pwsh: echo ${{ parameters.test }}     

Result:

enter image description here enter image description here

So when you are dealing with special characters in parameters, please pay attention to the single quotes.

Is the space required ?

No, the space is not required. '${{connectivity}}' and'${{ connectivity }}' are the same.

Upvotes: 1

Related Questions