developer9969
developer9969

Reputation: 5236

Printing template parameters in azure devops template

Is there a task or command that I can use to output all the parameters variable in a Azure DevOps template when the pipeline is run?

I would like the first task in the pipeline to print all parameters, that would help to spot mistakes.

Any suggestions

Upvotes: 7

Views: 6053

Answers (3)

Eyal
Eyal

Reputation: 71

I've found this to work for me: (as just using the respond above gave an error)

- powershell: |    
    $jsonParams = '${{ convertToJson(parameters) }}'
    Write-Host $jsonParams
  displayName: 'Print parameters in JSON format'

Upvotes: 5

matei.navidad
matei.navidad

Reputation: 745

I was also faced with this requirement and found the following solution:

    - script: |    
       echo "${{ convertToJson(parameters) }}"

Documentation for convertToJson

Upvotes: 10

Krzysztof Madej
Krzysztof Madej

Reputation: 40633

At the moment there is no way to display template parameters using single command, so your only option is printing them one be one like this:

- script: |
    echo 'vmImage - ${{ parameters.vmImage }}'
    echo 'anotherRuntimeParameter - ${{ parameters.anotherRuntimeParameter }}'

Upvotes: 1

Related Questions