title: Variable group yaml variable expression in Azure Devops Pipeline
body: <p>I'm having difficulties with variable expression with the AzureKeyVault task. Both the azureSubscription and KeyVaultName values expressions are not being resolved to have variables in a variable Group. It works if I define those variables manually in any way in the yaml. Either in azure-pipelines.yml or in the template variables_test.yml that I import at the beginning of the stage.</p>
  <p>I read in the documentation, that variables from a variable group should be used like this $(var) but then it throws an error saying a subscription like '$(var)' does not exist.</p>
  <p>Template:
  azure-pipelines.yml:</p>
  <pre><code>- stage: Test
  
    variables:
    - template: variables_Test.yml  # Template reference
    - group: testVariableGroup
  
    dependsOn: []
  
    jobs:
  
    - job: Test
      
      steps:
  
      - task: AzureKeyVault@1
        inputs:
          azureSubscription: ${{ variables.spn_kv_app }}
          KeyVaultName: ${{ variables.keyVaultName }}
          SecretsFilter: '*'
  </code></pre>
  <p>In the logs from the staging i can see the variables being set from the variable group:</p>
  <pre><code>Job preparation parameters
  Variables:
    keyVaultName: $[ variablegroups.testVariableGroup.keyVaultName ]
    resourceGroupName: $[ variablegroups.testVariableGroup.resourceGroupName ]
    spn_cd_app: $[ variablegroups.testVariableGroup.spn_cd_app ]
    spn_kv_app: $[ variablegroups.testVariableGroup.spn_kv_app ]
    storageAccountName: $[ variablegroups.testVariableGroup.storageAccountName ]
  </code></pre>
  <p>Important thing to note that those variables are not set to secrets in the variable group.</p>
  <h3>PS. For anyone interested. I created tickets:</h3>
  <p><a href="https://github.com/MicrosoftDocs/vsts-docs/issues/7586" rel="nofollow noreferrer">https://github.com/MicrosoftDocs/vsts-docs/issues/7586</a></p>
  <p><a href="https://developercommunity.visualstudio.com/content/problem/949342/azuresubscription-serviceconnection.html" rel="nofollow noreferrer">https://developercommunity.visualstudio.com/content/problem/949342/azuresubscription-serviceconnection.html</a></p>
  <p>If anything will be reslved i will post an answer.</p>