title: How to pass variables to templates for task conditions in YAML pipeline
body: <p>I have a YAML template that handles deployment of several Azure Functions:</p>
  <pre class="lang-yaml prettyprint-override"><code>parameters:
    azureSubscription: ''
    services: []
  
  steps:
  - ${{ each service in parameters.services }}:
    - task: AzureRmWebAppDeployment@4
      displayName: Deploy Azure Function ${{ service.name }}
      inputs:
        ConnectionType: 'AzureRM'
        azureSubscription: '${{ parameters.azureSubscription }}'
        appType: 'functionApp'
        WebAppName: '${{ service.webAppName }}'
        packageForLinux: '${{ service.packagePath }}'
  </code></pre>
  <p>In the main pipeline, I'm calling the template very simply passing an array of functions and the required parameters:</p>
  <pre class="lang-yaml prettyprint-override"><code># Deploy Azure Functions
  - template: ../Deploy/deploy-azure-functions.yml
    parameters:
      azureSubscription: 'XXX'
      services:
      - service: 
        name: 'Func 1'
        webAppName: 'func1'
        packagePath: 'Func1.zip'
      - service: 
        name: 'Func 2'
        webAppName: 'func2'
        packagePath: 'Function2.zip'
  </code></pre>
  <p>Now everything works as expected because all the functions needs to be deployed. However, I have the need to exclude Function 2 when a certain condition (that I understand only at runtime) is valid.</p>
  <p>Let me make an example. Suppose just before deploying all the Azure Functions I have a PowerShell scripts that creates the variable:</p>
  <pre><code>- pwsh: | 
      # Do some calculation and determine whether to proceed with deployment
      Write-Host &quot;##vso[task.setvariable variable=DEPLOY;]$deploymentEnabled&quot;
    displayName: 'Set dynamic variable'
  </code></pre>
  <p>Now I have into the variable $(DEPLOY) a value (true of false) that indicates whether I can deploy or not a certain function. I would then expect to have the value passed in the template, like:</p>
  <pre class="lang-yaml prettyprint-override"><code># Deploy Azure Functions
  - template: ../Deploy/deploy-azure-functions.yml
    parameters:
      azureSubscription: 'XXX'
      services:
      - service: 
        name: 'Func 1'
        webAppName: 'func1'
        packagePath: 'Func1.zip'
      - service: 
        name: 'Func 2'
        webAppName: 'func2'
        packagePath: 'Function2.zip'
        deploy: $(DEPLOY)
  </code></pre>
  <p>Please notice that the deploy parameter was added just for Function 2, because I need to always deploy Function 1 and I want this to be an optional parameter, so that when it's omitted, then the deployment will occur.</p>
  <p>Now I have to change the template to something like:</p>
  <pre><code>- ${{ each service in parameters.services }}:
   - task: AzureRmWebAppDeployment@4
     displayName: Deploy Azure Function ${{ service.name }}
     condition: or(eq('${{ service.deploy }}', ''), eq('${{ service.deploy }}', 'true')) 
     inputs:
       ConnectionType: 'AzureRM'
       azureSubscription: '${{ parameters.azureSubscription }}'
       appType: 'functionApp'
       WebAppName: '${{ service.webAppName }}'
       packageForLinux: '${{ service.packagePath }}'
  </code></pre>
  <p>Notice the condition: if value for parameter 'deploy' is not set or the value is 'true', then the deployment should happen, otherwise it should be skipped.</p>
  <p>While I though to be quite straightforward, it is not, because the variable is not evaluated and it's passed as a string (I guess the template evaluation comes first). Is there a way to make this working?</p>