title: DevOps template with conditional manual approval job
body: <p>I am trying to add approval job based on the stage, I am using template and want to skip approval for some stages:</p>
  <pre><code>parameters:
  - name: Stage
    type: string
  - name: Environment
    type: string
  - name: WebAppName
    type: string
  - name: ArtifactName
    type: string
  - name: DependsOn
    type: object
    default: [] 
  - name: Subscription
    type: string
  - name: isApproval
    type: boolean
    default: false 
  
  stages:
  
  ############################################################
  # Deploy stages
  ############################################################
  
  - stage: ${{ parameters.Stage }}  
    displayName: '${{ parameters.Stage }} Stage'
    dependsOn: '${{ parameters.DependsOn }}' # this will execute based on the stage that is passed.
  
    jobs:
    - job: approval
      condition: eq('${{ parameters.isApproval }}', true)
      pool:
        vmImage: 'windows-latest'
      steps:
      - task: ManualIntervention@8
        timeoutInMinutes: 1440 # task times out in 1 day
        inputs:
          emailRecipients: 'example@example.com'
          instructions: 'Please validate the build configuration and resume'
              
    - deployment: ${{ parameters.Environment }} 
      ${{ if eq('${{ parameters.isApproval }}', true)}}:
        dependsOn: approval
      timeoutInMinutes: 70
      environment: '${{ parameters.Environment }} Environment'
      pool:
        vmImage: 'windows-latest'
      strategy:
        runOnce:
          deploy:
            steps:
            - task: DownloadBuildArtifacts@0
              inputs:
                buildType: 'current'
                downloadType: 'single'
                artifactName: ${{ parameters.ArtifactName }}
                downloadPath: '$(System.ArtifactsDirectory)'
            - task: AzureRmWebAppDeployment@4
              inputs:
                ConnectionType: 'AzureRM'
                azureSubscription: ${{ parameters.Subscription }} 
                appType: 'webApp'
                WebAppName: ${{ parameters.WebAppName }}
                package: '$(System.ArtifactsDirectory)/**/*.zip'
  </code></pre>
  <p>And now from the release pipeline, I am passing values to the template:</p>
  <pre><code>- template: stages\deploy.yml 
      parameters:
        Environment: 'Dev'
        WebAppName: 'azureappservicehelloworldapp-dev'
        Stage: 'Dev'
        ArtifactName : '$(ArtifactName)'
        Subscription: 'AzureConnectionSC'
        # empty DependsOn, as Dev depends on nothing
        DependsOn:
        - Build
  
    - template: stages\deploy.yml 
      parameters:
        Environment: 'UAT'
        WebAppName: 'azureappservicehelloworld-uat'
        Stage: 'UAT'
        ArtifactName : '$(ArtifactName)'
        Subscription: 'AzureConnectionSC'
        DependsOn:
        - Dev
        isApproval: true
  
    - template: stages\deploy.yml 
      parameters:
        Environment: 'Prod'
        WebAppName: 'azureappservicehelloworld'
        Stage: 'Prod'
        ArtifactName : '$(ArtifactName)'
        Subscription: 'AzureConnectionSC'
        DependsOn:
        - UAT
        isApproval: true
  </code></pre>
  <p>If you see IsApproval is sent as true from UAT &amp; Prod templates, so I should be able to validate approval for UAT &amp; prod and DEV should be deploy without any approval.</p>
  <p>But I am getting below error for the approval job in the template:</p>
  <p><a href="https://i.stack.imgur.com/hf4Q6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hf4Q6.png" alt="enter image description here" /></a></p>
  <p>Manualintervention task is giving error, any suggestions plz.</p>