title: How can an Azure DevOps pipeline agent cleanly reboot itself?
body: <p>We have a Azure Devops pipeline where the agent is running on the app nodes for simplicity.  We added a task to the stage to upgrade the .net framework, which requires a reboot.  However, when the machine reboots during the deploy, the deploy agent process is killed and the stage fails to complete.  The pipeline is aware that a reboot was occurring and it ran one more task on the stage before the reboot occurred during the subsequent task.</p>
  <pre><code>Job issues
  1 error
  1 warning
  Operating system is shutting down for computer '(redacted)'
  </code></pre>
  <p>We redeployed the stage and the .net install task detected it was already up-to-date and skipped the reboot and the stage completed successfully this time.</p>
  <p>Is there a clean way to create a task to reboot the machine and wait until the reboot completes to resume the stage deployment?</p>