Create An Azure Virtual Machine Scale Set(VMSS) From A Custom Image.
Source: Dev.to
What is a Virtual Machine Scale Set (VMSS)?
An Azure Virtual Machine Scale Set allows you to create and manage a group of load‑balanced VMs. The number of VM instances can automatically increase or decrease in response to demand or a defined schedule.
Skills Needed
- Ability to create a Virtual Machine in Azure
1. Create a Virtual Machine
- In the Azure portal, search for Virtual Machine and select + Create.
- Basics tab
- Create a new Resource Group.
- Provide a VM name and choose a Region.
- Select an Availability Zone (if desired).
- Choose a Security type.
- Pick an Image.
- Create an Admin account for the VM.
- Select the appropriate Inbound ports and confirm the image eligibility.
- Monitoring blade – disable Boot Diagnostics (this prevents the cloud host from monitoring your activities).
- Review the configuration and click Create.
- After deployment, navigate to Resources.
2. Add and Format Disk in the Virtual Machine
- In the VM’s Overview, go to Settings → Disks.
- Click + Add data disk, name the disk, choose the size, and click Apply.
- Connect to the VM via RDP: download the RDP file and log in.
- Inside the VM, open Disk Management (search for it).
- Right‑click the unallocated disk, select New Volume, and follow the wizard to format the disk.
The disk is now formatted and ready for use.
3. Create an Azure Compute Gallery
- In the Azure portal, search for Azure Compute Galleries.
- Click + Create.
- Use the same Resource Group as the VM, give the gallery a name, and complete the creation steps.
4. Capture the Virtual Machine Image
-
In the VM’s Overview, click Capture and select Image.
-
Basics tab – ensure the Subscription, Resource Group, and Region match the original VM.
-
Enable Image Share to Azure Compute Gallery and select the gallery created in the previous step.
-
Choose the Operating System state:
- Generalized – the image requires hostname, admin user, etc., to be set on first boot.
- Specialized – the image is fully configured and does not require those parameters.
-
Provide a Target name, Version number, and Replication count, then review and click Create.
Note: Creating the captured image will automatically shut down the source VM.
5. Create a Virtual Machine Scale Set (VMSS)
-
After the captured image is ready, go to Resources and select + Create VMSS.
-
Use the default Subscription, Resource Group, and Region, then give the VMSS a name.
-
Choose an Orchestration mode:
- Flexible – provides high availability with identical VM specifications.
- Uniform – suited for large‑scale, stateless workloads that may have varying specifications.
-
Set Scaling mode to No scaling (as this article demonstrates a static set).
-
Review the configuration and click Create.
The VMSS is now created and highly available.