title: Passing an object into a template in Azure DevOps pipeline
body: <p>I'm trying to refactor an Azure DevOps job which runs on about 100 accounts, currently these are individual tasks in the pipeline which are almost identical. They happen to call some Cloud Formation in AWS, but that's not really important.</p>
  <p>I want to have a template parameter in the pipeline something like :-</p>
  <pre><code>parameters:
  - name: stackparams
    type: object
    default:
      - displayname: AWS Test User Account
        awscredentials: TESTAWS-appaccounttest1-AzureDevOps
        templatefile: ./Test/TestApp/SwitchRolesGroupsPolicies.yml
        templateparametersfile: ./Test/LZTestApp/demoparams.json
      - displayname: Second Account
        awscredentials: TESTAWS-appaccounttest2-AzureDevOps
        templatefile: ./Test/Something/SwitchRolesGroupsPolicies.yml
        templateparametersfile: ./Test/Something/demoparams.json
  </code></pre>
  <p>And in the template something like :-</p>
  <pre><code>parameters:
  - name: stackparams
    type: object
  
  steps:
  - ${{ each stackparam in parameters.stackparams }}:
    - checkout: self
    - task: AWSShellScript@1
      inputs:
        awsCredentials: ${{ stackparams.awscredentials }}
        regionName: 'eu-west-1' 
        scriptType: 'inline'
        inlineScript: |
          echo &quot;\$STACKPARAMS_DISPLAYNAME: $STACKPARAMS_DISPLAYNAME&quot;
      displayName: 'This is a test - ${{ stackparams.displayname }}'
  </code></pre>
  <p>However, I don't know if that's even possible and there's scant little documentation about doing it this way. I have replaced the Cloud Formation with just an AWSShellScript for the time being, just for a proof of concept. The error I'm currently getting is :-</p>
  <pre><code>&gt; /Templates/CfnUpdateStack/CfnUpdateStack.yml (Line: 25, Col: 23):
  &gt; Unrecognized value: 'stackparams'. Located at position 1 within
  &gt; expression: stackparams.awscredentials. For more help, refer to
  &gt; https://go.microsoft.com/fwlink/?linkid=842996
  &gt; /Templates/CfnUpdateStack/CfnUpdateStack.yml (Line: 33, Col: 18):
  &gt; Unrecognized value: 'stackparams'. Located at position 48 within
  &gt; expression: format('Collect Cost Optimisation Data - {0}',
  &gt; stackparams.displayname). For more help, refer to
  &gt; https://go.microsoft.com/fwlink/?linkid=842996
  &gt; /Templates/CfnUpdateStack/CfnUpdateStack.yml (Line: 25, Col: 23):
  &gt; Unrecognized value: 'stackparams'. Located at position 1 within
  &gt; expression: stackparams.awscredentials. For more help, refer to
  &gt; https://go.microsoft.com/fwlink/?linkid=842996
  &gt; /Templates/CfnUpdateStack/CfnUpdateStack.yml (Line: 33, Col: 18):
  &gt; Unrecognized value: 'stackparams'. Located at position 48 within
  &gt; expression: format('Collect Cost Optimisation Data - {0}',
  &gt; stackparams.displayname). For more help, refer to
  &gt; https://go.microsoft.com/fwlink/?linkid=842996
  </code></pre>