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.