Table of contents
1.
Introduction
2.
Log in to Azure
3.
Create a load balancer
4.
Create a virtual machine scale set
5.
Clean up resources
6.
Create a resource group
7.
Create a scale set
8.
Understand VM instance images
9.
Understand VM instance sizes
10.
Common management tasks
11.
Frequently Asked Questions
11.1.
How does Azure's VM scale set work?
11.2.
Can we add an existing virtual machine to a scale set?
11.3.
In a virtual machine scale set, how many VMs may I have?
11.4.
What is the difference between a VM and a VMSS?
11.5.
Is it possible to remove a virtual machine from the availability set?
12.
Conclusion
Last Updated: Mar 27, 2024

Azure Virtual Machine Scale Sets

Author Manan Singhal
0 upvote
Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction

Using a virtual machine scale set, you can deploy and manage a collection of auto-scaling virtual machines. You can manually scale the number of VMs in the scale set or create rules to autoscale based on resource consumption, like CPU, RAM, or network traffic. The traffic is subsequently distributed to the VM instances in the scale determined by an Azure load balancer. In this quickstart, you'll use the Azure portal to construct a virtual machine scale set.

Log in to Azure

Go to https://portal.azure.com to access the Azure portal.

Create a load balancer

Incoming traffic is distributed among healthy virtual machine instances by the Azure load balancer.

To begin, use the gateway to construct a public Standard Load Balancer. The load balancer's front end is immediately configured using the name and public IP address you provide.

  1. Type load balancer into the search box.
  2. Under marketplace in the search results, select Load balancer.
  3. In the Basics tab of the Create load balancer page, enter the required information.
  4. After entering details, select Review + create.
  5. After it passes validation, select Create.

Create a virtual machine scale set

A scale set can be deployed using a Windows Server image or a Linux image like RHEL, CentOS, Ubuntu, or SLES.

  1. In the search box, type scale set. Select Virtual machine scale sets from the Marketplace section of the results. Click Create on the Virtual machine scale sets page, which will take you to the Create a virtual machine scale set page.
  2. Make sure the relevant subscription is selected under Project information in the Basics tab, then choose myVMSSResourceGroup from the resource group list.
  3. Your scale set's name should be myScaleSet.
  4. Select a region nearer to your location in Region.
  5. Make sure the Uniform option for Orchestration mode is selected under Orchestration.
  6. Choose an image from the marketplace for Image. In this case, we'll use Ubuntu Server 18.04 LTS as an example.
  7. Choose your preferred login method and enter your desired username.
    A password must be 12 characters long and meet three difficulty requirements: one lower case, one upper case, one number, and one unique character. See the username and password requirements for further information.
    You can choose the SSH public key instead of a Linux OS disc image if you select a Linux OS disc image. Only your public key, such as ~/.ssh/id_rsa.pub, should be provided. Use the Azure Cloud Shell to produce and use SSH keys.
  8. To proceed to the next page, select Next.
  9. For the Disks page, leave the defaults alone.
  10. Go to the Networking page and pick the Use a load balancer option under Load balancing.
  11. Select Azure load balancer from the Load balancing options menu.
  12. Select the myLoadBalancer that you built previously in Select a load balancer.
  13. Select Create new, type myBackendPool, and then select Create for Select a backend pool.
  14. Select Review + create after you're finished.
  15. Select Create to deploy the scale set after it passes validation.

Clean up resources

Delete all the resource groups, scale set, and even all related resources when they are no longer required. To do so, pick the scale set's resource group and click Delete.

Create a resource group

A resource group is a logical container for deploying and managing Azure resources. Before you can scale a virtual computer, you must first construct a resource group. With the az group create command, you can create a resource group.

az group create --name myResourceGroup --location eastus

Create a scale set

The az vmss to create a command creates a virtual machine scale set. All scale set resources and VM instances are created and configured in a matter of minutes. A load balancer is also established to distribute traffic to the individual VM instances.

az vmss create \
  --resource-group myResourceGroup \
  --name myScaleSet \
  --image UbuntuLTS \
  --admin-username azureuser \
  --generate-ssh-keys

Understand VM instance images

A --image of UbuntuLTS was given for the VM instances when you built a scale set at the start of the tutorial. Many images on the Azure Marketplace can be used to build virtual machine instances. Use the az vm image list command to obtain a list of the most regularly used images.

az vm image list --output table

Understand VM instance sizes

The number of computing resources available to the VM instance, such as CPU, GPU, and RAM, is determined by the VM instance size or SKU. A scale set's VM instances must be appropriately sized for the predicted workload.

Common management tasks

You may now construct a scale set, view connection details, and connect to virtual machine instances. You learned how to utilize a new OS image, choose a different VM size, and manually scale the number of instances for your VM instances. You may need to start, stop, or restart the VM instances in your scale set as part of day-to-day operations.

Frequently Asked Questions

How does Azure's VM scale set work?

You can construct and manage a group of load-balanced VMs using Azure virtual machine scale settings. The number of virtual machine instances can be increased or decreased automatically in response to demand or a set timetable.

Can we add an existing virtual machine to a scale set?

You can no longer add an existing standalone VM to a VM scale set. There are a few actions you must take to accomplish this. Additionally, if you have a classic VM resource, it adds two extra steps to the process.

In a virtual machine scale set, how many VMs may I have?

When scaling out, the maximum number of instances you intend to deploy. It monitors application demand and adds or removes virtual machines as needed.

What is the difference between a VM and a VMSS?

VM Scale sets automatically create extra VM instances based on central configuration, traffic balancing and distribution, high availability and redundancy, and VM scaling.

Is it possible to remove a virtual machine from the availability set?

You can add or remove VMs from an availability set without having to delete or recreate it. If you're using PowerShell, you have the following options: For old VMs, use Remove-AzureAvailabilitySet. For Resource Manager VMs, use Remove-AzureRmAvailabilitySet.

Conclusion

In this article, we have understood the Azure Virtual Machine scale sets. We hope this blog will help you understand the concept of Azure Virtual Machine scale sets, and if you want to learn more about Azure, check out our other blogs on the AWS vs azure vs google cloudMicrosoft Azure, and Microsoft Azure certification.

You can also consider our Online Coding Courses such as the Machine Learning Course to give your career an edge over others.

Happy Coding!

Live masterclass