Deploying an Auto-Scaling VM Scale Set with a Custom Disk Image

Deploying a VM Scale Set via the Azure portal is straightforward when you are just using a clean, vanilla Windows OS image from the list that Azure provides you.  However, what if a scale set that consists of a bunch of vanilla servers doesn’t help me?  What if I need to host a website on an infrastructure that scales up and down to meet demand?

I spent Sunday morning working on this exact problem.

If I need to deploy a group of IIS virtual machines that not only run the same web app but also scale up and down as demand changes, I am going to want to deploy an auto-scaling Virtual Machine Scale Set (VMSS) that is based on a custom disk image that contains my OS and fully configured web app.  Otherwise, how are the additional instances that are automatically spun up going to run my web app?

The process was a bit more challenging than I expected.  However, I was able to pull it off with some work.

To accomplish my goal, I had to complete the following tasks:

  • Deploy a VM on Managed Disk
  • Install IIS on my VM and Configure the Web App
  • SysPrep the VM
  • Shutdown and Stop the VM
  • Capture the VM Disk Image
  • Note the Location of the Image
  • Build a Scale Set Template (actually borrowed one)
  • Add Autoscale Settings to the Scale Set Template
  • Ensure the Scale Set Template References the Captured Disk Image as the OS Disk
  • Deploy the Scale Set Template

As you can see, there were actually quite a few steps involved to get this right.  Unfortunately, it is what it is – you cannot use the Azure Portal alone to deploy an auto-scaling VM Scale Set that’s built on a custom disk image.

Click here to join the Understanding Azure Facebook group or here for the latest Azure practice questions, answers, explanations, and reference materials.

Thomas Mitchell

Tom is a 20+ year veteran of the IT industry and carries numerous Microsoft certifications, including the MCSE: Cloud Platform and Infrastructure certification. A Subject Matter Expert in Active Directory and Microsoft Exchange, Tom also possesses expert-level knowledge in several other IT disciplines, including Azure, Storage, and O365/Exchange Online. You can find Tom at his website, on LinkedIn, or on Facebook. Need to reach him by phone? Call 484-334-2790.