title: Using powershell, how can i re-run a release which has failed in azure-devops using an api?
body: <p>what can i put in which can help me re run a failed release in azure devops?</p>
  <pre><code>$timer = New-TimeSpan -Minutes 120
  while ($sw.elapsed -lt $timer) {  
          $ReleaseStatus  = Invoke-RestMethod -Uri &quot;https://vsrm.dev.azure.com/company/project/_apis/release/releases/$RId/environments/$EId/?`api-version=6.0&quot; -Method GET -Headers $Header -Verbose
          start-sleep -seconds 10
          
          if ($ReleaseStatus.Status -eq 'Succeeded') {
              write-host &quot;Release Succeeded&quot;
              return
              }
          if ($ReleaseStatus.status -eq 'Rejected' -or 'active') {
                  Invoke-RestMethod &quot;https://vsrm.dev.azure.com/company/project/_apis/release/releases?api-version=6.0&quot; -Method POST -Headers $Header -Body $Body -Verbose
                  write-host &quot;Error occured, Re-running Release&quot;
                  return
              }
              
                      
      }
  </code></pre>