title: VSTS Devops deployed failed rollback to previous version with web and database?
body: <p>Devops automatic rollback to the previous version when deployed failed(Web &amp; Database)</p>
  
  <p>I have installed the <strong>Release Management Utility</strong> Tasks extension in your account, you’ll see a task called “<strong>Rollback powershell</strong>” in the task</p>
  
  <p>I have tried to below "Rollback PowerShell" code, but not working.</p>
  
  <pre><code>try
  {    
  $jsonobject = ConvertFrom-Json $env:Release_Tasks
  
  }
  catch
  {
  Write-Verbose -Verbose “Error parsing Release_Tasks environment variable”
  Write-Verbose -Verbose $Error
  } 
  foreach ($task in $jsonobject | Get-Member -MemberType NoteProperty)
  { 
  $taskproperty = $jsonobject.$($task.Name) | ConvertFrom-Json
  Write-Verbose -Verbose “Task $($taskproperty.Name) with rank $($task.Name) has status $($taskproperty.Status)”
  // Perform rollback action required in case $task.Name has status failed   
  } 
  </code></pre>
  
  <p>This method is correct? if any other way?</p>
  
  <p>Thanks</p>