Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Printing template parameters in azure devops template

Tags:

azure-devops

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

like image 631
developer9969 Avatar asked May 12 '26 20:05

developer9969


2 Answers

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

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

Documentation for convertToJson

like image 65
matei.navidad Avatar answered May 16 '26 08:05

matei.navidad


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'
like image 32
Eyal Avatar answered May 16 '26 08:05

Eyal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!