title: Passing output variables between Azure Devops build pipeline steps, for example 7 digit git hash
body: <p>I am trying to include the 7-digit git hash in the artifact name built by my Azure Devops build pipeline. In my build agent job I have an inline powershell script with the following lines:</p>
  
  <pre class="lang-bsh prettyprint-override"><code>$commitId = "$(Build.SourceVersion)"
  $shortCommitId = ("$commitId").SubString(0,7)
  </code></pre>
  
  <p>In the options for the Powershell script under "Output variables" I add a reference name: <code>ps</code>.</p>
  
  <p>Then in the Publish Artifact step right after my Powershell step I set the artifact name as: </p>
  
  <pre><code>$(ApplicationName)_Rel_$(ps.shortCommitId)_$(build.buildnumber)
  </code></pre>
  
  <p>The actual result after the pipeline has finished running is:</p>
  
  <pre><code>MyApplication_Rel_$(ps.shortCommitId)_20190918.1
  </code></pre>
  
  <p>How do I pass the variable shortCommitId between steps so that it will be part of the artifact name? <code>MyApplication_Rel_04f53f_20190918.18</code>.</p>