title: Azure Pipeline Matrix Strategy Variable Expansion problem in conjunction with templates
body: <p>For often used tasks in azp I created an own repository with a yml file, I'll show you a subpart of that:
  create-and-upload-docu.yml:</p>
  <pre class="lang-yaml prettyprint-override"><code>parameters:
  - name: Documentation
    type: string
    default: ''
  
  - name: Language
    type: string
    default: ''
  
  - name: ArchiveBaseDir
    type: string
    default: ''
  
  steps:
  - script: |
      ARCHIVERELPATH=${{parameters.Documentation}}-${{parameters.Language}}.zip
      ARCHIVEDIR=$(echo -n ${{parameters.ArchiveBaseDir}} | sed -e 's@/$@@')/${{parameters.Documentation}}/${{parameters.Language}}
      echo &quot;##vso[task.setvariable variable=archiveRelPath;isOutput=true]$ARCHIVERELPATH&quot;
      echo &quot;##vso[task.setvariable variable=archiveDir;isOutput=true]$ARCHIVEDIR&quot;
    name: ${{parameters.Documentation}}_${{parameters.Language}}_params
  
  - task: DeleteFiles@1
    inputs:
      Contents: '$(Build.ArtifactStagingDirectory)/$(${{parameters.Documentation}}_${{parameters.Language}}_params.archiveRelPath)'
  
  </code></pre>
  <p>The relevant part is: the &quot;script&quot; has the name which is unique in a job - so I can use this kind of expansion for setting variables within the template:</p>
  <pre class="lang-yaml prettyprint-override"><code>$(${{parameters.Documentation}}_${{parameters.Language}}_params.archiveRelPath)
  </code></pre>
  <p>This works fine as long as I had called the template with fixed values, like</p>
  <pre class="lang-yaml prettyprint-override"><code>- template: create-and-upload-docu.yml@templates
            parameters:
              Documentation: 'adocuvalue'
              Language: 'en_US'
              ArchiveBaseDir: '$(Build.ArtifactStagingDirectory)/build/'
  </code></pre>
  <p>But now I want to use a matrix to have a few documentations with a few languages:</p>
  <pre class="lang-yaml prettyprint-override"><code>jobs:
    - job: Documentation_CI
      displayName: &quot;Docu CI&quot;
      timeoutInMinutes: 30
      strategy:
        matrix:
          main_en_US:
            Documentation: main
            Language: en_US
          main_de_AT:
            Documentation: main
            Language: de_AT
      steps:
        - checkout: self
        - template: create-and-upload-docu.yml@templates
            parameters:
              Documentation: ${{variables.Documentation}}
              Language: ${{variables.Language}}
              ArchiveBaseDir: '$(Ws)/build/'
  </code></pre>
  <p>But at the time where ${{}} expressions are expanded, it seems that the matrix variables are not already set; this means that the template script part is called __params and the pipeline has the following error
  <code>Publishing build artifacts failed with an error: Input required: ArtifactName</code></p>
  <p>Is there a somewhat simple way to achive what I want (being able to set some variables within templates with a unique naming schema):</p>
  <ul>
  <li>can I somehow use ${{ expressions but need a different naming to get to the hard-coded matrix style variables</li>
  <li>can I workaround my problem any simple way?</li>
  </ul>
  <p>Additional Info: we run a Azure 2020 on prem.</p>