title: Can you pass Variable Group values to sub template in yaml?
body: <p>I'm trying to create a multi-stage pipeline which has Variable Groups defined for each stage of the pipeline. The goal is to pass values from the group as parameters to a sub template. It seems the value of the Group, defined at the stage, is not getting passed in to the sub template. It overrides the &quot;DEFAULTVALUE&quot; with an empty string.</p>
  <p><strong>pipeline.yml</strong></p>
  <pre><code>trigger:
  - none
  
  pool:
    name: 'Azure Pipelines'
    vmImage: windows-latest
  
  stages:
    - stage: DEV
      variables:
        - group: my-group-dev
      jobs:
        - template: sub-template.yml
          parameters:
            env: 'dev'
            subscriptionName: '$(SubscriptionName)' # This reference from the variable group doesn't get passed in
            subscriptionId: '$(SubscriptionId)'
  
    - stage: TEST
      variables:
        - group: my-group-test
      jobs:
        - template: sub-template.yml
          parameters:
            env: 'test'
            subscriptionName: '$(SubscriptionName)' # This reference from the variable group doesn't get passed in
            subscriptionId: '$(SubscriptionId)'
  </code></pre>
  <p><strong>sub-template.yml</strong></p>
  <pre><code>parameters:
    env: 'DEFAULTVALUE'
    subscriptionName: 'DEFAULTVALUE'
    subscriptionId: 'DEFAULTVALUE'
  
  jobs:
    - deployment: ResourceDeployment
      displayName: Deploy Resources ${{ parameters.env }}
      environment: ${{ parameters.env }}
      strategy:
        runOnce:
          deploy:
            steps:
              - task: AzureFileCopy@4
                displayName: 'Upload ARM Templates'
                inputs:
                  sourcePath: '$(Pipeline.Workspace)/templates'
                  azureSubscription: '${{ parameters.subscriptionName }}'
                  destination: 'azureBlob'
                  storage: 'my-storage-account'
                  containerName: 'arm'
                name: AzureFileCopy
  
              - task: AzureResourceManagerTemplateDeployment@3
                inputs:
                  deploymentScope: 'Resource Group'
                  azureResourceManagerConnection: '${{ parameters.subscriptionName }}'
                  subscriptionId: '${{ parameters.subscriptionId }}'
                  action: 'Create Or Update Resource Group'
                  resourceGroupName: 'my-resource-group'
                  location: 'eastus2'
                  templateLocation: 'URL of the file'
                  csmFileLink: '$(AzureFileCopy.StorageContainerUri)${{ parameters.env }}/templates/main.json$(AzureFileCopy.StorageContainerSasToken)'
  </code></pre>
  <p>I have also tried adding the variable group within the sub-template but that also doesn't parse correctly...</p>
  <p>Does anyone know if this is possible?</p>