DEV Community

1suleyman
1suleyman

Posted on

Managing Virtual Machines in Azure: AZ-104 Lab 08 Review

Introduction

As part of my journey to becoming an Azure Administrator, I recently completed Lab 08 - Manage Virtual Machines from the AZ-104 certification series. This lab was designed to teach how to create, configure, and scale both individual virtual machines (VMs) and virtual machine scale sets (VMSS) in Azure.
Through this hands-on experience, I gained valuable skills in VM management, including manual scaling, vertical and horizontal scaling, and autoscaling with VMSS. In this blog post, I’ll share the key takeaways, step-by-step breakdown, and lessons I learned from this lab.

Lab Overview

In this lab, I learned to deploy, configure, and scale Azure Virtual Machines (VMs) both manually and automatically using Azure Virtual Machine Scale Sets (VMSS). The main tasks included deploying VMs across availability zones for high availability, resizing VMs, adding disks, and scaling with VMSS to optimize performance and reduce administrative overhead.

Skills Practiced:
✅ Deploying VMs across availability zones for high availability
✅ Managing compute and storage scaling for individual VMs
✅ Creating and configuring Azure Virtual Machine Scale Sets (VMSS)
✅ Implementing autoscaling for VMSS
✅ Deploying and managing VMs using PowerShell and Azure CLI

Task 1: Deploy Zone-Resilient Azure Virtual Machines by Using the Azure Portal
The first task involved deploying two VMs into different availability zones. This ensures high availability (HA) with a 99.99% uptime SLA for the VMs. Here’s what I did:

1️⃣ Signed into the Azure portal – Azure Portal.

2️⃣ Deployed two virtual machines (az104-vm1 and az104-vm2) into East US, with each VM located in a different availability zone (Zone 1 and Zone 2).

3️⃣ Configured the VMs with a Windows Server 2019 image, Standard D2s v3 size, and set a secure password.

4️⃣ Ensured that the Availability Zone option was enabled, deploying the VMs into separate zones to increase fault tolerance.

📌 Insight:
Deploying VMs across multiple availability zones ensures high availability and resilience to failures, which is essential for mission-critical applications.

Task 2: Manage Compute and Storage Scaling for Virtual Machines
Next, I focused on resizing the virtual machine and adding additional storage. Here's what I did:

1️⃣ Resized az104-vm1 from Standard DS1_v2 to a different size (DS1_v2, or an available size).

2️⃣ Attached a new data disk (vm1-disk1) to the VM and later changed its storage type from Standard HDD to Standard SSD to improve performance.

3️⃣ I also detached the disk and observed the process of scaling compute resources and storage individually.

📌 Insight:
Azure allows you to scale both the compute (VM size) and storage (disk size/type) of your VMs, offering flexibility to adjust resources as your workloads change.

Task 3: Create and Configure Azure Virtual Machine Scale Sets (VMSS)
In this task, I learned to create a VMSS that automatically scales VMs across availability zones. Here’s what I did:

1️⃣ Created a VMSS named vmss1, deployed across three availability zones, and set the image to Windows Server 2019 Datacenter.

2️⃣ Configured the VMSS with a load balancer, network security group (NSG), and public IP for external access.

3️⃣ Set up scaling options, including the number of instances and configured autoscaling rules based on CPU utilization.

📌 Insight:
VMSS simplifies the management of large-scale VM deployments by automatically balancing load and scaling VMs up or down based on demand, reducing manual intervention and improving resource efficiency.

Task 4: Scale Azure Virtual Machine Scale Sets
Here, I configured autoscaling for the VMSS based on CPU utilization. Here’s what I did:

1️⃣ Set up two scaling rules: one to scale out (add more VMs) when CPU utilization exceeds 70%, and another to scale in (remove VMs) when CPU usage falls below 30%.

2️⃣ I set instance limits (min: 2, max: 10) to ensure the scale set doesn't grow or shrink beyond a reasonable size.

📌 Insight:
Autoscaling based on metrics like CPU utilization ensures that VMSS automatically adjusts to demand, optimizing both performance and cost-efficiency.

Task 5: Create a Virtual Machine Using Azure PowerShell (Optional)
In this task, I used Azure PowerShell to create a virtual machine. Here's what I did:

1️⃣ Opened Cloud Shell, selected PowerShell, and created a VM with the following command:

powershell

New-AzVM -ResourceGroupName 'az104-rg8' -Name 'myPSVM' -Location 'East US' -Image 'Win2019Datacenter' -Zone '1' -Size 'Standard_D2s_v3' -Credential (Get-Credential)

2️⃣ Verified the VM’s status with Get-AzVM.

📌 Insight:
Azure PowerShell is a powerful tool for managing Azure resources through scripts, providing automation and greater control over VM creation and management.

Task 6: Create a Virtual Machine Using the CLI (Optional)
In this task, I used the Azure CLI to create a VM. Here's what I did:

1️⃣ Opened Cloud Shell, selected Bash, and created a VM with the following command:

bash

az vm create --name myCLIVM --resource-group az104-rg8 --image Ubuntu2204 --admin-username localadmin --generate-ssh-keys

2️⃣ Verified the VM creation with az vm show.

📌 Insight:
The Azure CLI is a versatile tool that provides an easy and consistent way to interact with Azure resources from the command line, especially useful for developers and sysadmins who are familiar with Linux environments.

Key Learnings

1️⃣ High Availability with Availability Zones
Deploying VMs across multiple availability zones helps ensure high availability and fault tolerance by distributing workloads in different physical locations.

2️⃣ Vertical and Horizontal Scaling
Scaling a VM’s size (vertical scaling) and changing disk types (storage scaling) offer flexibility in adapting the VM to changing workloads. VMSS provides horizontal scaling by adding or removing VMs automatically based on defined metrics.

3️⃣ VMSS for Automated Scaling
VMSS allows automatic scaling of virtual machines based on specific conditions like CPU load, helping to maintain performance during high demand while optimizing costs.

4️⃣ Azure PowerShell and CLI
Azure PowerShell and CLI are both essential tools for managing Azure resources, offering command-line interfaces for deploying, configuring, and automating virtual machine and scale set creation.

Conclusion

Completing this lab enhanced my understanding of Azure Virtual Machines and Virtual Machine Scale Sets. I learned how to deploy VMs with high availability, scale them vertically and horizontally, and automate scaling with VMSS. By using tools like Azure PowerShell and the Azure CLI, I also gained hands-on experience in managing VMs efficiently. These skills are essential for optimizing infrastructure and ensuring high availability, reliability, and cost-efficiency in Azure environments.

🚀 Stay tuned for my next blog post on Lab 09a - Implement Web Apps!

🔗 Follow my journey as I continue mastering Azure Administration! 🚀

Top comments (0)