Azure - Uncategorized

Shutdown and Startup Azure VM’s based on Tags

Like many people we want to shutdown Azure VM’s when they are not being used, however with different time zones and working schedules this can vary. The obvious way is to shutdown VM’s based on Tags.

Jobs can be scheduled through the Automation Account or via a Logic App if preferred.

The script was originally created by Christopher Scott, however it was using the older commands. I’ve updated the commands and also allowed for the tag name to be set as a Runbook Parameter when executing, these can easily be changed. This script is set to use an Azure RunAs Automation Account, but this can of course be run interactively by removing this section. The script is set to use a Tag called “ShutdownCycle” you can change this to whatever you want.

Shutdown Script

Start Up Script

Hope this helps!

Leave a Reply

Your email address will not be published. Required fields are marked *