• Home
  • Services
    • Cloud
    • Cybersecurity
    • Consulting
    • Enterprise Solutions
    • IT Services
    • Network Solutions
  • Vision & Mission
  • Blogs
  • About Us
  • Contact
  • Careers
  • Home
  • Services
    • Cloud
    • Cybersecurity
    • Consulting
    • Enterprise Solutions
    • IT Services
    • Network Solutions
  • Vision & Mission
  • Blogs
  • About Us
  • Contact
  • Careers
  • Home
  • Services
    • Cloud
    • Cybersecurity
    • Consulting
    • Enterprise Solutions
    • IT Services
    • Network Solutions
  • Vision & Mission
  • Blogs
  • About Us
  • Contact
  • Careers
  • Home
  • Services
    • Cloud
    • Cybersecurity
    • Consulting
    • Enterprise Solutions
    • IT Services
    • Network Solutions
  • Vision & Mission
  • Blogs
  • About Us
  • Contact
  • Careers
Technical BlogTechnology

How to Schedule and Automate Your Virtual Machine Size with Azure Automation Accounts

July 18, 2025 by Syed Dawood Waheed

Are you looking to optimize cloud costs and performance? Learn how to automatically resize your Azure Virtual Machines (VMs) using Azure Automation Accounts.

Managing cloud resources efficiently is key to optimizing performance and controlling costs. In this guide, you’ll learn how to automate Azure VM resizing using Azure Automation Accounts and Runbooks. Whether you’re scaling up for high-traffic hours or scaling down after hours, this tutorial shows you how to schedule automatic virtual machine size changes based on your business needs — no manual intervention required.

Step 1:

Go to Azure portal and search for Automation Accounts.

 

Step 2:

Click on Create Automation Account.

 

 

Step 3:

Enter the detail and click on Review + Create.

Step 3: Enter the detail and click on Review + Create.

 

 

Step 4:

Verify detail and click on Create and wait for the deployment to be complete.

 

 

 

Step 5:

Once deployment is complete, Click on Go to Resource.

 

 

Step 6:

Search Identity and copy Object ID.

 

 

Step 7:

Go to the Resource Group of VM you want to Automatically Resize.

 

Access Control (IAM) -> Add Role Assignment

 

 

 

Step 8:

On the Job function roles, select Virtual Machine Contributor.

 

 

Step 9:

Go to the members tab and select Managed Identity then select Review + Assign.

 

 

Step 10:

Now go back to Automation Account which was created earlier. Then Go to Runbooks and Create a runbook.

 

 

 

Step 11:

Fill the details and click review and create.

 

 

 

Step 12:

Enter the following command in the Runbook by entering your VM’s Resource Group, VM Name, New VM Size and then click Publish.

 

param (

    [string]$ResourceGroupName = "VM Resource Group",

    [string]$VMName = "VM Name",

    [string]$NewVMSize = "New VM Size"

)

# Login to Azure

Connect-AzAccount -identity

# Stop the VM

Stop-AzVM -ResourceGroupName $ResourceGroupName -Name $VMName -Force

# Update VM size

$vm = Get-AzVM -ResourceGroupName $ResourceGroupName -Name $VMName

$vm.HardwareProfile.VmSize = $NewVMSize

Update-AzVM -ResourceGroupName $ResourceGroupName -VM $vm

# Start the VM

Start-AzVM -ResourceGroupName $ResourceGroupName -Name $VMName

Write-Output "VM $VMName resized to $NewVMSize"

 

 

 

Step 13:

Schedule VM to resize automatically.

 

Go to Schedules then Add a Schedule then link Runbook with your schedule.

 

 

Note: You can create multiple runbooks within the same Automation Account by following the same steps and schedule them as needed. For example, you might want your VM to run with 16 GB RAM in the morning and 4 GB RAM at night.

 

Please be aware that the virtual machine will reboot to apply the size changes according to the defined schedules.

 

 

Conclusion

Automating your Azure Virtual Machine resizing with Automation Accounts and Runbooks is a smart way to optimize performance, reduce costs, and streamline resource management. With just a few steps, you can take full control over your VM scaling strategy and align your cloud infrastructure with your business needs.

Need expert help implementing Azure automation or scaling your cloud infrastructure?
Partner with ITCS—your trusted technology partner for secure, scalable, and cost-efficient IT solutions in Pakistan.

📩 Contact us today to discuss how we can support your digital transformation goals.

automate Azure virtual machine scaling with Automation Accounts automated VM size management for Azure resource groups. automatically change VM size based on time of day in Azure automatically scale Azure VMs using PowerShell script and runbook best practices for automating Azure infrastructure tasks cloud cost optimization with Azure VM size scheduling create runbook to resize Azure VM during off-peak hours how to automate Azure VM size changes using runbooks how to use managed identity for Azure Automation tasks reduce Azure billing by automating virtual machine scaling resize Azure VM daily using Automation Account and schedule resize Azure VM on a schedule without manual intervention schedule virtual machine resizing to optimize Azure cost step-by-step guide to resize virtual machines in Azure automatically use Azure runbooks to schedule VM resizing tasks
LLMs Gone Rogue: The Dark Side of Generative AILLMs Gone Rogue: The Dark Side of Generative AIJuly 2, 2025

ITCS strives to provide its customers with the best possible solutions using the latest available technology.
Head Office

6/K Block 2, P.E.C.H.S, Karachi, Pakistan

Email:

info@itcs.com.pk

Phone:

021 111-482-711

Fax:

021 4554818

Services

Cloud Solutions

IT Consulting

Enterprise Solutions

IT Services

Network Solutions

Cybersecurity

Recent Blogs
How to Schedule and Automate Your Virtual Machine Size with Azure Automation Accounts
July 18, 2025
LLMs Gone Rogue: The Dark Side of Generative AI
July 2, 2025

Copyright © 2023 ITCS (IT Consulting and Services). All Rights Reserved

#integrio_soc_icon_wrap_687a79ae91f7a a{ background: #1E1139; border-color: transparent; }#integrio_soc_icon_wrap_687a79ae91f7a a:hover{ background: #ffffff; border-color: #1E1139; }#integrio_soc_icon_wrap_687a79ae91f7a a{ color: #ffffff; }#integrio_soc_icon_wrap_687a79ae91f7a a:hover{ color: #1E1139; }.integrio_module_social #soc_icon_687a79ae91fb61{ color: #ffffff; }.integrio_module_social #soc_icon_687a79ae91fb61:hover{ color: #ffffff; }.integrio_module_social #soc_icon_687a79ae91fb61{ background: #44b1e4; }.integrio_module_social #soc_icon_687a79ae91fb61:hover{ background: #44b1e4; }.integrio_module_social #soc_icon_687a79ae91fcb2{ color: #ffffff; }.integrio_module_social #soc_icon_687a79ae91fcb2:hover{ color: #ffffff; }.integrio_module_social #soc_icon_687a79ae91fcb2{ background: #4661c5; }.integrio_module_social #soc_icon_687a79ae91fcb2:hover{ background: #4661c5; }.integrio_module_social #soc_icon_687a79ae91fd83{ color: #ffffff; }.integrio_module_social #soc_icon_687a79ae91fd83:hover{ color: #ffffff; }.integrio_module_social #soc_icon_687a79ae91fd83{ background: #ff2e2e; }.integrio_module_social #soc_icon_687a79ae91fd83:hover{ background: #ff2e2e; }.integrio_module_social #soc_icon_687a79ae91fe44{ color: #ffffff; }.integrio_module_social #soc_icon_687a79ae91fe44:hover{ color: #ffffff; }.integrio_module_social #soc_icon_687a79ae91fe44{ background: #c135b6; }.integrio_module_social #soc_icon_687a79ae91fe44:hover{ background: #c135b6; }#blog_module_687a79ae97c33.blog-posts .blog-post_title, #blog_module_687a79ae97c33.blog-posts .blog-post_title a { color:#c7ccc3; }#blog_module_687a79ae97c33.blog-posts .blog-post_title:hover, #blog_module_687a79ae97c33.blog-posts .blog-post_title a:hover { color:#c7ccc3; }#blog_module_687a79ae97c33.blog-posts .blog-post_title, #blog_module_687a79ae97c33.blog-posts .blog-post_title a { font-size:16px; line-height:24px; }