Adding Alerts to shutdown an Azure Virtual Machine

Copper Contributor

Hi all, 

 

I'm running a lab in Azure for training purposes. Now using a DevTest Lab I could schedule a shutdown period to turn off a VM during off hours but I would like to be more granular and have the VM shutdown after one hour of inactivity for example. Or having the server turned off automatically after 2 hours of operation no matter what. 

 

I configured an alert based on "System\System Up Time" metric but no results.   

 

 

4 Replies

Hi Eric,

As i understand you don't want to use all your cred's for waiting for the auto shutdown.

With Azure Automation it's possible to do what you want. If i understand you correct.
It's in preview now and her you got a link for it. So if you create rules based on CPU, Memory, Disk or so on. You can possible create some Automation on what you want to do.
I will look in to it my self as well.
Here you got a link for preview
https://docs.microsoft.com/en-us/azure/automation/automation-solution-vm-management

Hi Thomas, 

 

True, I don't want to wait for auto shutdown if I'm not using the VM.. Auto shutdown is a great feature but I still feel I'm wasting money on VM time not being used.  

 

Thank you for your reply and link. This is exactly what I was looking for! :) 

@Eric Lacroix 

 

How about creating a scheduled task in the VM to initiate a shutdown?

@Eric Lacroix have you looked at the Start/Stop VMs during off-hours solution in Azure Automation? One of the scenarios covered by this solution is exactly what you want.