DEV Community

Cover image for Scaling Azure Virtual Machines with Data Disks and VM Scale Sets
lotanna obianefo
lotanna obianefo

Posted on

Scaling Azure Virtual Machines with Data Disks and VM Scale Sets

With growing cloud adoption, organizations need scalable, resilient, and efficient VM infrastructures. Azure addresses this with data disks for expanded storage and Virtual Machine Scale Sets (VMSS) for automated scaling and high availability.

This comprehensive guide explores the process of building a scalable VM infrastructure in Azure, integrating data disks for persistent storage and leveraging VMSS for dynamic resource management.

Deploy a Virtual Machine

Azure Portal provides an intuitive way to create and manage Virtual Machines, starting with selecting the Virtual Machines section, creating a new VM, and specifying the Subscription and Resource Group for organization.

01
02
03
Next, select an OS image Windows, Linux, or custom and set the VM size to fit workload requirements for compute, memory, and storage. For this test project, select Windows 10 (click the ‘All images’ dropdown to view more options).

Enable Azure Spot Discount to lower costs, create an admin account with a username and password, and configure inbound port rules RDP is enabled by default, add HTTP to allow internet traffic to the VM.

I04
05
In the Monitoring tab, disable Boot Diagnostics to enhance privacy, preventing the cloud provider from capturing or viewing your VM’s boot process.
06
For accurate showback and chargeback reporting, apply a Tag specifying the department, purpose, and responsible staff for the VM.
Confirm Licensing then Review+Create
07
08
Wait for it to validate, click Create to deploy.
09

Assign Access To VM

The deployed Virtual Machine is exclusively assigned to designated individuals with authorized access.

On the deployed VM, navigate to the Resource section, access the Access control (IAM) blade, and select +Add to create a new role assignment.
10
11
In the job function role search, locate and select "Virtual Machine Administrator Login." Prior to assigning a member, ensure that the user, group, or service principal option is activated, granting the designated entity appropriate access privileges.
12
13
14
To extend the idle timeout for the virtual machine, access the Overview blade, select the associated public IP address, and adjust the timeout value to its maximum limit. This configuration ensures the VM remains active and prevents automatic logouts due to inactivity.
15
16

Adding A Data Disk To The VM

Data disks in a VM provide additional storage capacity, enabling the separation of application data from the operating system for better performance, scalability, and data management.

In the VM settings, search for Disk, create and attach a new disk, assign a name, and select locally redundant storage (LRS) for cost effective data replication within a single region and click Apply.
17
18

Data Disk Initialization

After attaching a new disk to the VM, it must be initialized to prepare it for partitioning and formatting before use.

Initializing a disk is essential as it enables the operating system to recognize it, allows partition creation, and prepares it for data storage and access.

To access the VM via RDP, click Connect, choose Native RDP, ensure the Public IP address is configured, then download the RDP file for connection.
19
20
Enter the administrator credentials to log in, then use the search bar to locate and open Disk Management for storage configuration and select OK to initialize the disk.
21
22
23
Navigate to Disk2 in the disk management interface, right-click to initiate formatting, and choose New Simple Volume to create a formatted partition.
24
On the Welcome page, click Next, specify the volume size, and assign a drive letter or path retaining the default settings unless customization is required.
25
26
27
On the Format Partition page, assign a volume label, configure the desired file system settings, and click Finish to complete the formatting process and make the disk ready for use.
28
29
The disk is now successfully formatted, with its status displaying as Healthy, indicating it is fully operational and ready for data storage.
30

Provision and Configure A Virtual Machine Scale Set (VMSS)

A Virtual Machine Scale Set (VMSS) is deployed to enable automated scaling and ensure high availability across multiple VM instances. Create a VM image before deploying the Virtual Machine Scale Set (VMSS).

Before capturing a VM image, create an Azure Compute Gallery, which serves as a centralized repository for storing, managing, and versioning VM images, enabling efficient image distribution and lifecycle management across the enterprise.

Deploy a compute gallery
Search for Azure Compute Gallery in the portal, initiate creation, assign a unique name, and deploy the resource.
00
001
002
003

Create an image from the VM.
From the VM Overview page, select Capture to create an image, retain the existing resource group, target the previously created Azure Compute Gallery, and set the OS state to Specialized to preserve current configurations and bypass reauthentication
004
005
Create a new image definition, assign a unique name, define the version number following the suggested format, and specify the image’s end-of-life date for lifecycle management.
006
007
For the default storage SKU, Standard HDD-LRS is the most cost effective option. Alternatively, the storage can be provisioned in a different region if required. After validating your settings, click Review+Create to provision the resource.
008
009
010

Deploy a Virtual Machine Scale Set (VMSS)
During image creation, the VM is automatically stopped, which takes approximately 5–10 minutes. In the resource, you can create either a VM or a VMSS.

To create a VMSS specify a name, increase the instance count from the default 2 to 5, select Windows Client from the dropdown, confirm eligibility, then click Review + Create and Create.
111
222
333
444
555
667
After deploying the VMSS, navigate to its resource and select Scaling under the Availability + Scale blade. You can configure autoscaling and adjust the instance count as needed.
777
888
Navigate to the Virtual Machine resource to view the five deployed VMSS instances.
999
Building a scalable VM infrastructure in Azure with data disks and VMSS enables efficient workload scaling. By integrating high performance storage and leveraging VMSS auto-scaling, organizations can ensure high availability, optimize performance, and control costs.

Top comments (1)

Collapse
 
realcloudprojects profile image
SKILL.SCH

Welldone!