title: How to add Scheduler and Trigger to a nested template in Azure devops pipeline?
body: <p>I am new to Azure devops and would like your suggestion. I have a main azure-pipeline.yml that refers a nested template (azure-pipeline-e2e.yml) file. Basically, when the main azure-pipeline.yml runs , it triggers the nested template wherein if the branch is not master, nested template jobs will be skipped.</p>
  <p>Query:</p>
  <p>I want the nested template to be run as part of overnight schedule. I also want this nested pipeline to have no trigger(trigger:none).... Please note that current set up works fine. Only When I add scheduler jobs and trigger jobs in the nested template, the main azure-pipeline.yml complains that Scheduler and Trigger commands are unknown? Please advise on how to have both the trigger and Scheduler in the nested pipeline such that main pipeline does not complain</p>
  <p>Current setup:
  main azure-pipeline.yml file</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>trigger:
  - master
  
  pool:
    name: EDEA
  
  stages:
  - stage: dev
    jobs:
    - job: build_test_deploy_UI_to_DEV
      steps:
      - task: NodeTool@0
        displayName: 'Install Node.js'
        inputs:
          versionSpec: '12.x'
          etc.....
  
  - stage: e2e
    condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) 
    displayName: 'Run e2e Tests'
    jobs:
    - template: 'azure-pipelines-e2e.yml'
  
  - stage: dtc
    jobs:
      - job: build_and_deploy_UI_to_DTC
        steps:
          - task: NodeTool@0
            displayName: 'Install Node.js'
            inputs:
              versionSpec: '12.x'
              etc.....</code></pre>
  </div>
  </div>
  </p>
  <p>nested template (azure-pipeline-e2e.yml)</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>jobs:
  - job: run_e2e_tests
    condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) 
    steps: 
    - task: SecretsManagerGetSecret@1
      displayName: Get AWS  secrets
      inputs:
        awsCredentials: 'project.dev.Aws'
        regionName: 'eu-central-1'
        secretIdOrName: 'secretname'
        variableName: 'tempvariable'</code></pre>
  </div>
  </div>
  </p>
  <p>Basically, in the nested template above, When I add scheduler and Trigger jobs, nested template does not complain. But the main azure pipeline complains that Scheduler and Trigger comands are unknown</p>
  <p>Proposed: azure-pipeline-e2e.yml</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>schedules:
    - cron: "0 0 * * *"
      displayName: Daily midnight build
      branches:
        include:
          - master
      always: true
  
  trigger: none
  
      jobs:
      - job: run_e2e_tests
        condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) 
        steps: 
        - task: SecretsManagerGetSecret@1
          displayName: Get AWS  secrets
          inputs:
            awsCredentials: 'project.dev.Aws'
            regionName: 'eu-central-1'
            secretIdOrName: 'secretname'
            variableName: 'tempvariable'</code></pre>
  </div>
  </div>
  </p>