Having a VM that constantly hits high CPU tends to underperform, in the Cloud world of Azure, you can easily Scale up and Down VM’s to meet these requirements, saving total Compute costs instead of having an Expensive VM consistently running.
Once configured, with Azure Automation you can easily Scale up and Down Virtual Machines automatically without ever logging into the portal or even turning on your laptop.
Before we start, here is my VM before anything gets configured or set up (Standard D1 v2 VM)
Click “Browse gallery” and search for “Vertically” , select which Runbook you wish to deploy, then click “Import”
Go over to your VM in the portal, in the side pane scroll down to “Monitoring”, and click “Add metric Alert”
Give your alert a name, and a description, making sure the ‘Metric’ is set to ‘Percentage CPU’
Add your own email address in there to be notified when the Alert is triggered and Successful, select the Runbook you imported, and click OK
I got my first email Alert to say that the Alert Metric was activated
And you’ll see in the ARM Portal, the Alert now says “Active”
Then 5 minutes later, another email Alert to say that the Alert Metric Resolved
Now here is the VM after (Standard D2 v2 VM)
Credit to “Kay Singh” for writing the PS RunbookFollow @CraigCloudITPro