title: Delete VSTS builds using the OAuth Token
body: <p>With the new possibility to get the OAuth token to access the VSTS API during a build, I tried to write a script which deletes certain builds.</p>
  
  <p>Reading builds works fine like this:</p>
  
  <pre><code>$headers = @{  Authorization = "Bearer $env:SYSTEM_ACCESSTOKEN"  }
  $baseUrl = "{0}{1}" -f $env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI, $env:SYSTEM_TEAMPROJECTID
  $buildsUrl = [string]::Format("{0}/_apis/build/builds?api-version=2.0", $baseUrl)
  $response = Invoke-WebRequest -Uri $buildsUrl -Headers $headers
  </code></pre>
  
  <p>But while trying to delete a build I get a <strong>403 Forbidden</strong> error:</p>
  
  <pre><code>$deleteUrl = [string]::Format("{0}/_apis/build/builds/{1}?api-version=2.0", $baseUrl, $id)
  $response = Invoke-WebRequest -Uri $url -Headers $headers -Method Delete
  </code></pre>
  
  <p>Is deleting just not possible with the OAuth token provided by VSTS to the build or do I need to call the delete request differently?</p>