title: Schedule Azure VM to turn on, run a script and turn off
body: <p>I have a multi-container app that I need to run twice a day at specific times for about 30 mins each time. To save costs, I would like to:</p>
  
  <ol>
  <li>Turn on a Linux VM on Microsoft Azure</li>
  <li>Run a script that runs <code>docker-compose up -d</code>, waits 30 mins, then calls <code>docker-compose stop</code></li>
  <li>Turn off the VM</li>
  </ol>
  
  <p>I'd love for this to happen automatically on a cron schedule.</p>
  
  <p>So far, I've failed to find any Azure solution that can do all of this. Azure automation allows you to turn on/off VMs but it doesn't allow you to run a sh script on it after you've turned it on. Azure Logic apps allows you to spin up containers on a schedule but not with docker-compose.</p>
  
  <p>Any idea on how I might accomplish this in a way that doesn't involve me having a VM that is always on?</p>