title: Using Environment Variables in a cURL request on Azure Devops
body: <p>I'm trying to upload a zip file to Netlify with a command line task using cURL on Azure DevOps.</p>
  
  <p>Obviously I don't want to have my Netlify access token in the yaml file, so I've created a secret variable for it (using the UI designer) and mapped it using the syntax in the <a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/process/variables?view=vsts&amp;tabs=yaml%2Cbatch#secret-variables" rel="nofollow noreferrer">docs</a>. </p>
  
  <p>However I keep getting a 401 back from Netlify. I can confirm via POSTMAN that the access token is valid. So I'm not sure what I'm doing wrong here. Am I using the env variables incorrectly in the request?</p>
  
  <p>here's the portion of the YAML file that deals with uploading the file.</p>
  
  <pre><code>- script:  &gt;-
        curl
        -H 'Authorization: Bearer $env:ACCESS_TOKEN' 
        -H 'Content-Type: application/zip'
        --data-binary '@$(Build.BuildId).zip'
        https://api.netlify.com/api/v1/sites/$env:SITE_ID/deploys
    workingDirectory: '$(Build.ArtifactStagingDirectory)'
    displayName: 'Upload to Netlify'
    env: 
      ACCESS_TOKEN: $netlifyAccessToken
      SITE_ID: $netlifySiteId
  </code></pre>
  
  <p>Response from Netlify:</p>
  
  <pre><code>{"code":401,"message":"Access Denied: Origin returned bad status 401"}` 
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>Below is the full YAML file after I managed to get it working using the 'input-macro' syntax from the <a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/process/variables?view=vsts&amp;tabs=yaml%2Cbatch#secret-variables" rel="nofollow noreferrer">docs</a></p>
  
  <pre><code>trigger:
  - master
  
  pool:
    vmImage: 'Ubuntu-16.04'
  
  variables:
    configuration: debug
    platform: x64
  
  steps:
  - task: DotNetCoreInstaller@0
    displayName: Install .NET Core SDK
    name: install_dotnetcore_sdk
    enabled: true
    inputs:
      packageType: 'sdk'
      version: '2.2.101'
  
  - script: dotnet tool install -g Wyam.Tool
    displayName: Install Wyam
  
  - script: wyam
    displayName: Build Site 
  
  - task: ArchiveFiles@2
    displayName: Zip Site
    inputs:
      rootFolderOrFile: '$(Agent.BuildDirectory)/s/output' 
      includeRootFolder: true
      archiveType: 'zip'
      archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip' 
      replaceExistingArchive: true
  
  - script:  &gt;-
        curl
        -H 'Authorization: Bearer $(netlifyAccessToken)' 
        -H 'Content-Type: application/zip'
        --data-binary '@$(Build.BuildId).zip'
        https://api.netlify.com/api/v1/sites/$(netlifySiteId)/deploys
    workingDirectory: '$(Build.ArtifactStagingDirectory)'
    displayName: 'Upload to Netlify'
  </code></pre>