title: How can you use environment variables in an Azure Powershell task in a DevOps Release Pipeline?
body: <p>In an Azure DevOps release pipeline, I have an Agent job. Within that Agent job, I have an Azure Powershell task. I do not see a way to specify environment variables for the Azure Powershell script that the Azure Powershell task runs.</p>
  <p>You can do it in a build pipeline by simply specifying &quot;env&quot; for the Azure PowerShell task:</p>
  <pre><code>- task: AzurePowerShell@5
    inputs:
      azureSubscription: '...'
      ScriptType: 'FilePath'
      ScriptPath: '...'
      ScriptArguments: '...'
      FailOnStandardError: true
      azurePowerShellVersion: 'LatestVersion'
    env:
      USERNAME: $(username)
      PASSWORD: $(password)
  </code></pre>
  <p>But I don't see any way of specifying &quot;env&quot; in a release pipeline:</p>
  <p><a href="https://i.stack.imgur.com/PnESN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PnESN.png" alt="Screenshot showing no way to add environment variables" /></a></p>
  <p>How can this be done?</p>