Automatically deallocate Azure VM’s

Automatically deallocate Azure VMs

Last month I was surprised to see that my Azure bill went up quite a bit. Not knowing that I forgot to deallocate my Azure development VMs. Fortunately, this didn’t break the bank, but would like to avoid this in the future. So therefore I created a simple script to Deallocate Azure VM’s.

Creating a Deallocate Azure VM’s script

I wanted to avoid using a witness server given that the VM’s only exist for demo and experimenting purposes (poor man’s solution warning!).

Just alter the parameter s and schedule execution via Windows Task Scheduler on the VM.

ATTN: I recently wrote a guide on how to automate this process using Microsoft Azure Automation. The blog post can be found here.

  • Mark Smith

    Hi Kevin,

    You can also use this tool, the Azure Virtual Machine Scheduler.

    Does this all for you and emails you the results

    • Thanks for sharing this tool, Mark! It’s looking very complete.

      Funny you mention this now, because I’ve recently created something similar by using Azure Scheduler, Logic Apps and Automation Webhooks. This was quite some work, albeit lots of fun as well.

      • Mark Smith

        Yeah, scripting can be fun. Good work Kevin.

Post Navigation