title: How to pass complex DevOps pipeline template parameter to script
body: <p>In an Azure DevOps pipeline template, I am declaring a parameter as an array/sequence</p>
  
  <pre><code>parameters:
    mySubscription: ''
    myArray: []
  
  steps:
  - AzureCLI@2
    inputs:
      azureSubscription: ${{ parameters.mySubscription }}
      scriptType: pscore
      scriptPath: $(Build.SourcesDirectory)/script.ps1
      arguments: '-MyYAMLArgument ${{ parameters.myArray }}'
  </code></pre>
  
  <p>Value for the parameter is then passed from pipeline definition as</p>
  
  <pre><code>steps:
  - template: myTemplate.yml
    parameters:
      mySubscription: 'azure-connection'
      myArray:
      - field1: 'a'
        field2: 'b'
      - field1: 'aa'
        field2: 'bb'
  </code></pre>
  
  <p>My problem is I can't pass that array as-is in YAML syntax (kind of <code>ToString()</code>) to be able to consume and treat that array from PowerShell in my template. When trying to run this pipeline, I get the following error:
  <code>/myTemplate.yml (Line: X, Col: X): Unable to convert from Array to String. Value: Array</code>. The line/column referenced in the error message correspond to <code>arguments: '-MyYAMLArgument ${{ parameters.myArray }}'</code> from my template.</p>
  
  <p>I also tried to map the parameter as an environment for my script</p>
  
  <pre><code>- AzureCLI@2
    inputs:
      azureSubscription: ${{ parameters.mySubscription }}
      scriptType: pscore
      scriptPath: $(Build.SourcesDirectory)/script.ps1
      arguments: '-MyYAMLArgument $Env:MY_ENV_VAR'
    env:
      MY_ENV_VAR: ${{ parameters.myArray }}
  </code></pre>
  
  <p>This does not work too: <code>
  /myTemplate.yml (Line: X, Col: Y): A sequence was not expected</code>. That time line/column refers to <code>MY_ENV_VAR: ${{ parameters.myArray }}</code>.</p>
  
  <p>Does anyone ever faced a similar requirement to pass complex types (here an array/sequence of object) defined from the pipeline definition to a PowerShell script? If so, how did you achieve it?</p>