title: Why do you specify a pool in a deployment job in Azure Pipelines?
body: <p>I find it hard to grasp the concept of deployment jobs and environments in Azure Pipelines. From what I understand, a <code>deployment job</code> is a sequence of steps to deploy your application to a specific environment, hence the <code>environment</code> field.</p>
  <p>If so, why is there also a <code>pool</code> definition for agent pool for that job definition?</p>
  <h3>EDIT</h3>
  <p>What bothers me is that, from what I understand, an <em>Environment</em> is a collection of resources that you can run your application on. So you'll define some for <strong>dev</strong>, some for <strong>stage</strong>, <strong>prod</strong>, etc. So you want to run the job on these targets. So why do we need to specify an agent pool to run the deployment job on? Shouldn't it run on the resources that belong to the specified environment?</p>
  <h3>EDIT</h3>
  <p>Take this pipeline definition for example:</p>
  <pre><code>
  jobs:
    # Track deployments on the environment.
  - deployment: DeployWeb
    displayName: deploy Web App
    pool:
      vmImage: 'Ubuntu-16.04'
    # Creates an environment if it doesn't exist.
    environment: 
       name: 'Stage'
       resourceType: VirtualMachine
    strategy:
      # Default deployment strategy, more coming...
      runOnce:
        preDeploy:
          steps:
          - script: echo &quot;Hello&quot;
        deploy:
          steps:
          - checkout: self 
          - script: echo my first deployment
  </code></pre>
  <p>I have an environment called &quot;Stage&quot; with one virtual machine on it.</p>
  <p><a href="https://i.stack.imgur.com/34imz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/34imz.png" alt="enter image description here" /></a></p>
  <p>When I run it, I can see both jobs run on my VM</p>
  <p><a href="https://i.stack.imgur.com/ifWF3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ifWF3.png" alt="enter image description here" /></a></p>
  <p>The agent pool specified is NOT USED at all.</p>
  <p>However, if I target another environment with no machines on it, it will run on Azure Pipelines vm</p>
  <p><a href="https://i.stack.imgur.com/Aovi6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Aovi6.png" alt="enter image description here" /></a></p>