Scale up Azure VMs using Automation runbooks and VM metrics

By Shijimol Ambi Karthikeyan

Azure automation runbooks can be used to enable scale up of virtual machines (VM). The metrics associated with the VMs can be used to trigger a runbook for scaling VM to the next available size.

The VM basic metrics are available on the overview pane of the VM. Note that these metrics are the host VM metrics, which is available from the Azure portal without any additional configuration. For detailed guest-OS metrics to be available, the diagnostics extension should be enabled for the VM . In this sample walk through, we will be using CPU percentage as the metrics which is available by default.

  1. Click on the VM overview and select CPU(average)

    VM Metrics
  2. Make sure that the right metrics is selected, which in this case is Host Percentage CPU. Select the 'Add metrics alert (classic)' option on the top to add the alert and configure web hook. Please note that there is a new metrics experience that is also available in the portal at the time of authoring this book, but in preview mode

    Add metric alert

  3. The 'Add rule' Wizard will open. Set the threshold to the desired value. In this example, the value is set to 80% Host CPU percentage

    CPU Utilization threshold

  4. You can either choose to run an automation runbook or call a logic app when the alert is triggered . Choose the option "Run a runbook from this alert".

    Take action

  5. Under the Configure Runbook option, enable the runbook and choose the config source as either built-in or user. If you select the option 'user', you get to choose from a runbook that you have created in your automation account. If you select 'Built-in', a list of runbooks is presented in a drop-down menu. Choose 'Scale up VM' to resize the VM to the next larger size. 

    Select runbook

  6. Choose the automation account for the runbook
    Choose Automation account

  7. Click OK on the Add Rule wizard to complete the configuration

About the Author

Shijimol Ambi Karthikeyan currently works as a cloud consultant with Microsoft. She has 12+ years' experience in IT and specializes in datacenter management, virtualization, and cloud computing technologies. She started her career with EY IT services in the datacenter management team managing complex virtualized production datacenters. She has expertise in managing VMware and Hyper-V virtualization stacks and Windows/Linux server technologies. She has also worked on devops CI/CD implementation projects using tools such as TeamCity, Jenkins, Git, TortoiseSVN, Mercurial, and Selenium. She later moved on to cloud computing and gained expertise in Windows Azure, focusing on Azure IaaS, backup/DR, and automation. She holds industry standard certifications in technologies including Microsoft Azure, Windows Server, and VMware. She also holds ITIL and TOGAF9 certifications.  She has previously written a book on Azure automation.

This blog post was contributed by Shijimol Ambi Karthikeyan, the author of “Practical Microsoft Azure IaaS: Migrating and Building Scalable and Secure Cloud Solutions”.