Azure architectureComputeIntermediate45 min read

What Does Azure virtual machine Mean?

Reviewed byJohnson Ajibi· Senior Network & Security Engineer · MSc IT Security
On This Page

Quick Definition

An Azure virtual machine is a computer that exists only as software inside Microsoft's data centers. You can choose its operating system, size, and software, and pay only for what you use. It acts just like a physical computer but runs in the cloud, accessible from anywhere. You manage it through the Azure portal, command line, or automated scripts.

Common Commands & Configuration

az vm create --resource-group myRG --name myVM --image UbuntuLTS --size Standard_B1s --admin-username azureuser --generate-ssh-keys

Creates an Ubuntu Linux VM in a resource group with SSH authentication. The --size parameter sets the SKU to a burstable B1s for cost-efficiency.

Tests your ability to create a VM with minimal parameters; often used in exam scenarios for cost optimization using B-series burstable SKU.

az vm show --resource-group myRG --name myVM --query "{Status:provisioningState, Size:hardwareProfile.vmSize, PrivateIP:networkProfile.networkInterfaces[0].ipConfigurations[0].privateIpAddress}"

Queries the provisioning state, VM size, and private IP address of an existing VM using JMESPath query.

Exams often ask how to retrieve VM details; JMESPath queries are a common way to extract specific fields without reading the full JSON output.

az vm deallocate --resource-group myRG --name myVM --no-wait

Stops and deallocates the VM, releasing the compute resources. The --no-wait flag returns immediately without waiting for the operation to finish.

This command is central to cost management scenarios-deallocating stops billing for compute but not for storage. The --no-wait flag is tested for automation scenarios.

az vm resize --resource-group myRG --name myVM --size Standard_D2s_v3

Resizes the VM to a different SKU within the same family. Requires the VM to be either stopped or running, but may require a reboot.

Resizing is a common exam topic; you must know that you can only resize to SKUs in the same hardware family and that a reboot may be needed. This tests your understanding of VM lifecycle and SKU constraints.

az network nsg rule create --resource-group myRG --nsg-name myNSG --name AllowRDP --protocol tcp --priority 1000 --destination-port-ranges 3389 --access allow

Creates an inbound NSG rule to allow RDP traffic on port 3389 from any source (default source IP prefix is '*').

NSG rules are frequently tested; you must know that by default all inbound traffic is denied, so explicit rules are needed. The priority value affects evaluation order.

az disk create --resource-group myRG --name myDataDisk --size-gb 128 --sku Premium_LRS --max-shares 1

Creates a 128 GB Premium SSD managed disk using locally redundant storage. The --max-shares parameter set to 1 means only one VM can attach it. For shared disks, set to 2+.

Exams test the difference between disk SKUs (Premium_LRS vs Standard_LRS vs StandardSSD_LRS) and the concept of max-shares for shared disks. This command is foundational for storage questions.

az vm encryption enable --resource-group myRG --name myVM --disk-encryption-keyvault myVault --volume-type all

Enables Azure Disk Encryption for both OS and data disks using an existing key vault. Requires the Azure Disk Encryption extension.

Encryption is a critical security topic; exams ask how to enable it, what prerequisites are (key vault, extension), and what volume types can be encrypted (OS, Data, All).

Azure virtual machine appears directly in 343exam-style practice questions in Courseiva's question bank — one of the most-tested concepts on AZ-104. Practise them →

Must Know for Exams

For the AZ-104 (Microsoft Azure Administrator) exam, Azure virtual machines are a major topic. You will be tested on deploying virtual machines, configuring availability sets and zones, scaling virtual machine scale sets, managing disks, and implementing backup and disaster recovery. Questions often ask you to choose the correct virtual machine size for a given workload, select the appropriate storage tier, or design a highly available architecture.

In the Azure Fundamentals (AZ-900) exam, you need to understand the basic concept of IaaS and how virtual machines fit into the shared responsibility model. You may be asked to differentiate between virtual machines, containers, and serverless computing. Simple scenario questions might ask when to choose a virtual machine versus PaaS services like Azure App Service.

For AWS exams like aws-cloud-practitioner, aws-developer-associate, and aws-saa, Azure virtual machines are not directly tested, but the concept of an EC2 instance is analogous. Understanding virtual machines on Azure helps you grasp similar concepts on AWS. Exams may ask you to compare and contrast AWS and Azure terminology or services. For example, an AWS question about EC2 instance types and pricing models maps directly to Azure virtual machine SKUs and reserved instances.

Google Cloud exams (google-ace and google-cloud-digital-leader) also cover virtual machines (called Compute Engine instances). The underlying principles of virtual networking, boot disks, machine types, and billing are nearly identical. Having a solid understanding of Azure virtual machines prepares you for any cloud certification's compute section.

Typical exam objectives include: deploy and configure virtual machines, configure high availability, implement storage for virtual machines, automate deployment with ARM templates, and manage virtual machine backups. Questions may present a scenario where you must recommend a virtual machine configuration that meets cost, performance, and compliance requirements.

Simple Meaning

Think of an Azure virtual machine as a rented computer that lives in a massive, highly secure building owned by Microsoft. You never see the actual computer. You tell Microsoft what kind of computer you want: how much memory, how many processors, what operating system, and what software. They instantly create that computer for you inside their building. You can connect to it remotely, install software, run applications, and do everything you would do with a physical desktop or server.

The key difference is that this computer is "virtual." It is not a single physical machine. Instead, it is a slice of a much larger physical server, created using special software called a hypervisor. The hypervisor divides the physical server's resources (CPU, memory, storage) into multiple isolated virtual machines. Each virtual machine behaves as if it owns those resources, even though many virtual machines share the same underlying hardware.

You can start, stop, resize, or delete the virtual machine whenever you want. If you need more power, you can increase its size in minutes. If you only need it for a few hours, you pay only for those hours. This flexibility is why companies love Azure virtual machines. They replace the need to buy, set up, and maintain physical servers in your own office. Instead, you rent computing power on demand.

Azure virtual machines are often called IaaS, which stands for Infrastructure as a Service. Microsoft provides the physical hardware and the virtualization layer, but you control the operating system, applications, and data. You are responsible for patching the operating system, configuring security, and backing up your data, just like you would with a physical server.

A helpful analogy is renting an apartment. The building (the physical data center) is owned by the landlord (Microsoft). The apartment itself (the virtual machine) is your private space. You can furnish it (install software), paint the walls (configure settings), and even change the lock (set up firewall rules). When you move out, you return the apartment, and the landlord can rent it to someone else. You do not worry about the building's plumbing, electricity, or structural repairs, those are the landlord's job. In the same way, Azure handles the physical hardware, network cables, cooling, and power, while you handle everything inside the virtual machine.

Full Technical Definition

An Azure virtual machine is a compute resource offering within Microsoft Azure's Infrastructure as a Service (IaaS) portfolio. It provides on-demand, scalable, and virtualized computing capacity. Each virtual machine runs on a physical server within an Azure data center, managed by Microsoft's hypervisor, which is based on Hyper-V technology. The hypervisor abstracts the physical hardware and allocates dedicated portions of CPU, memory, local storage, and network bandwidth to each virtual machine instance.

Azure virtual machines are defined by a specific SKU (Stock Keeping Unit) that determines the virtual machine's family, type, size, and capabilities. The families include general purpose, compute optimized, memory optimized, storage optimized, GPU, and high-performance compute. Each size specifies the number of vCPUs (virtual CPUs), the amount of RAM, temporary storage (SSD or HDD), and network bandwidth. For example, a Standard_D2s_v3 size offers 2 vCPUs and 8 GB of RAM, and is part of the general-purpose D-series. The vCPUs are mapped to physical processor cores on the host server, with hyper-threading enabled on most modern Azure hosts.

Storage for an Azure virtual machine is decoupled from the compute via Azure Managed Disks. Managed Disks come in three performance tiers: Premium SSD, Standard SSD, and Standard HDD. The operating system disk is typically a managed disk, and you can attach additional data disks. Disks are replicated within the Azure region for durability. The virtual machine connects to its disks through the Virtual Hard Disk (VHD) format, which uses page blobs in Azure Storage.

Networking is provided through Azure Virtual Network (VNet). Each virtual machine has a virtual network interface card (NIC) attached to a subnet within a VNet. You can assign private IP addresses (from the subnet's range) and optionally a public IP address for internet access. Network Security Groups (NSGs) act as a stateful firewall to control inbound and outbound traffic. Azure also supports accelerated networking using SR-IOV (Single Root I/O Virtualization) for improved performance.

Availability is managed through availability sets and availability zones. An availability set distributes virtual machines across multiple fault domains (shared power and network) and update domains (to avoid simultaneous maintenance). Availability zones place virtual machines in physically separate data centers within a region. For disaster recovery, Azure Site Recovery can replicate virtual machines to another region.

You deploy and manage Azure virtual machines via the Azure portal, Azure CLI, PowerShell, ARM (Azure Resource Manager) templates, or REST APIs. The virtual machine uses a preconfigured image from the Azure Marketplace, which includes Windows Server, various Linux distributions (Ubuntu, CentOS, Red Hat, SUSE), or custom images. Billing is per-second for most sizes, and you can choose between pay-as-you-go, reserved instances, or spot instances.

The underlying infrastructure uses Azure Fabric Controller, which orchestrates the placement, health monitoring, and lifecycle of virtual machines. The Fabric Controller communicates with the hypervisor to start, stop, migrate, and resize virtual machines without user intervention. Live migration is used to move a running virtual machine to a different physical host during maintenance, preserving uptime.

Security is multi-layered: Azure Defender for Cloud provides threat detection, Azure Disk Encryption (using BitLocker for Windows, DM-Crypt for Linux) protects data at rest, and Azure Bastion offers secure RDP/SSH access without public IP exposure. Virtual machines can also be joined to Azure Active Directory for identity-based management.

Real-Life Example

Imagine you are a chef who wants to open a pop-up restaurant in a different city every week. You do not want to buy a full kitchen, oven, stove, refrigerator, and counters for each location because that would be expensive and impractical. Instead, you rent a fully equipped commercial kitchen for a day. You tell the kitchen rental company what equipment you need: a six-burner stove, a large convection oven, refrigerator space, and prep counters. They prepare that exact kitchen for you in their facility. You bring your own ingredients and pots, cook your meals, serve your customers, and at the end of the day, you leave. The rental company cleans the equipment and readies it for the next chef.

In this analogy, the rental kitchen facility is the Azure data center. The specific kitchen setup you requested is your Azure virtual machine. The stove and oven represent the vCPU, the refrigerator space is the memory, and the prep counters are the storage. You, the chef, are the IT administrator or developer. The ingredients are your application code and data. You configure the equipment (install software), cook (run your application), and when you are done, you stop the rental and pay only for the time you used.

Now, suppose next week you need a different setup: maybe a wood-fired pizza oven instead of a convection oven. With the rental company, you simply request a different kitchen configuration. You do not need to buy new equipment or move heavy appliances. Similarly, in Azure, you can change your virtual machine size or create a new one with different specifications in minutes. You never touch the physical hardware.

A key part of the analogy is separation of responsibility. The rental company ensures the kitchen is clean, the gas lines are safe, the electrical wiring is up to code, and the refrigerator is cold. You, however, must clean your own pots, store your ingredients properly, and follow food safety rules. In Azure, Microsoft ensures the physical hardware is running, the network cable is plugged in, and the data center is secure. You must update the operating system, configure the firewall, and protect your data with backups.

This pop-up restaurant model is exactly why businesses use Azure virtual machines. Instead of building their own data center (buying a permanent restaurant space), they rent compute capacity on demand. They can scale up during busy seasons (holiday sales) and scale down during slow periods. They can test a new application (a new recipe) without a large upfront investment. And they can shut down the entire operation (deallocate the virtual machine) when not needed, saving money.

Why This Term Matters

Azure virtual machines are the foundation of cloud computing for many organizations. They allow businesses to move from capital expenditure (buying servers) to operational expenditure (paying for usage). This shift reduces financial risk and provides agility. Instead of waiting weeks for hardware procurement, a developer can spin up a virtual machine in minutes. Companies can test new software, run development environments, or handle traffic spikes without over-provisioning.

For IT professionals, understanding Azure virtual machines is critical because they are the most common starting point for cloud migrations. Many legacy applications are lifted and shifted into virtual machines with minimal changes. Knowing how to select the right size, configure networking, manage disks, and set up high availability directly impacts cost and performance. Mistakes in sizing can lead to overspending or poor application performance.

Azure virtual machines also serve as the compute backbone for other Azure services. For example, Azure Virtual Desktop uses virtual machines to deliver remote desktops. Azure Batch runs large-scale parallel workloads on virtual machine pools. Even Azure Kubernetes Service nodes are virtual machines under the hood. Therefore, mastering virtual machine concepts is a prerequisite for learning many other Azure services.

Security is another reason this matters. Because you are responsible for securing the operating system and applications inside the virtual machine, you must know how to apply patches, configure firewalls, and manage identity. Misconfigured virtual machines are a common vector for breaches. Azure provides tools like Azure Security Center and just-in-time access, but you must implement them correctly.

Finally, cost management is intertwined with virtual machines. You can save up to 72% with reserved instances or use spot instances for fault-tolerant workloads. Stopping a virtual machine (deallocated state) stops billing for compute, but storage still incurs cost. These nuances are essential for any cloud practitioner.

How It Appears in Exam Questions

Scenario-based questions are the most common. For example: "Your company runs a web application on a single Azure virtual machine. During peak hours, users report slow response times. What should you do?" The correct answer might be to scale up the virtual machine to a larger size or scale out using a virtual machine scale set. Distractors include adding more storage or changing the region.

Configuration questions ask you to specify parameters. For instance: "You need to deploy a Windows virtual machine that supports SQL Server with high IOPS. Which storage type should you choose?" The answer would be Premium SSD. You might also be asked to write an ARM template snippet, though that is less common in multiple-choice exams.

Troubleshooting questions focus on connectivity or performance. Example: "You cannot connect to your Azure virtual machine via RDP. The virtual machine is running and has a public IP address. What is the likely cause?" Answers could involve Network Security Group rules blocking port 3389, missing route, or the virtual machine not having a public IP assigned.

Availability and disaster recovery questions often present a scenario: "You need to ensure your virtual machines remain available during Azure planned maintenance. What should you configure?" The answer is an availability set with multiple update domains. Another common question: "You need to replicate a virtual machine to another region for disaster recovery. Which service should you use?" Answer: Azure Site Recovery.

Cost optimization questions appear frequently: "You have a development virtual machine that runs only during business hours. How can you minimize costs?" Options include deallocating the virtual machine when not in use, using reserved instances, or moving to a smaller size. Deallocating stops billing for compute but keeps storage.

Finally, you may see comparison questions: "What is the difference between an availability set and an availability zone?" The correct answer emphasizes that availability sets protect against hardware failures within a single data center, while availability zones protect against entire data center failures within a region.

Practise Azure virtual machine Questions

Test your understanding with exam-style practice questions.

Practise

Example Scenario

You are an IT administrator for a small e-commerce company. The company expects heavy traffic during a Black Friday sale. Currently, your product catalog runs on a single on-premises server that is five years old and cannot be upgraded quickly. Your manager asks you to move the application to Azure so it can handle the spike and then scale back down.

You decide to use an Azure virtual machine. You log into the Azure portal and create a new virtual machine. You choose Windows Server 2022 as the operating system and select a Standard_D4s_v3 size, which gives you 4 vCPUs and 16 GB of RAM. You attach a Premium SSD managed disk for fast data access. You place the virtual machine in a virtual network with a public IP address and configure an NSG to allow only HTTPS traffic on port 443. You migrate the product catalog application and database to the virtual machine.

On Black Friday, traffic surges. You monitor the virtual machine's CPU and memory usage in Azure Monitor. You see that the virtual machine is hitting 90% CPU utilization. You decide to scale up by changing the virtual machine size to a Standard_D8s_v3 with 8 vCPUs. The change takes effect without downtime (the virtual machine reboots briefly). The application runs smoothly.

After the sale, traffic returns to normal. You resize the virtual machine back to the smaller size to save costs. You also set up a schedule to deallocate the virtual machine overnight when no one is shopping. This scenario demonstrates how Azure virtual machines give you flexibility to match your infrastructure to real-time demand, all without buying new hardware.

Common Mistakes

Choosing the wrong virtual machine size for the workload

Selecting a size that is too small leads to poor performance and potential downtime. Sizing too large wastes money. Each workload has different CPU, memory, and I/O requirements, and not all sizes are optimal for every task.

Use Azure Virtual Machine selector tools or performance monitoring data to choose a size that matches your application's profile. Start small, test, and scale up as needed.

Forgetting to deallocate a stopped virtual machine to save costs

Stopping a virtual machine from the operating system (shutdown) does not deallocate it. The virtual machine continues to incur compute charges because the underlying hardware is still reserved. Only deallocating (stopping from Azure portal) releases the compute resources and stops billing.

Always use the Azure portal, CLI, or PowerShell to stop and deallocate a virtual machine when it is not needed. Alternatively, use auto-shutdown policies.

Not configuring a Network Security Group (NSG) or misconfiguring rules

By default, a new virtual machine might have no NSG attached, leaving it exposed to the internet. Even with an NSG, common mistakes are opening too many ports, using overly permissive rules like 0.0.0.0/0 for RDP or SSH, or forgetting to allow necessary traffic.

Always attach an NSG to the subnet or NIC. Follow the principle of least privilege: only allow required ports and source IP ranges. Use Azure Bastion for secure management instead of public RDP/SSH.

Placing all virtual machines in a single availability zone or no availability set

Without distribution across fault domains and update domains, a single hardware failure or Azure maintenance can bring down all your virtual machines. This violates high availability best practices.

For production workloads, use at least two virtual machines in an availability set or across two availability zones. This ensures that if one fails, the other continues running.

Using temporary storage (D: on Windows, /dev/sdb1 on Linux) for persistent data

Temporary storage is not persistent. It is created from the host server's local SSDs and can be lost during maintenance, resizing, or deallocation. Storing important data there results in data loss.

Always use managed data disks (Premium SSD, Standard SSD) for persistent data. Use temporary storage only for page files, swap files, or temporary application caches.

Ignoring the difference between basic and standard public IP addresses

Basic SKU public IP addresses do not support availability zones, have a shorter SLA, and lack certain features like zone-redundancy. Using them for production can lead to connectivity issues during zone failures.

Always use Standard SKU public IP addresses for production workloads. They are zone-redundant and have a 99.99% SLA when combined with availability zones.

Exam Trap — Don't Get Fooled

{"trap":"You are asked to confirm whether a deallocated virtual machine still incurs billing charges. Many learners think a stopped virtual machine, even deallocated, still costs money for compute.","why_learners_choose_it":"They confuse the stopped (allocated but powered off) state with the deallocated state.

In a non-deallocated stopped state, the hardware is reserved, and you pay for compute. Common documentation might use \"stop\" ambiguously.","how_to_avoid_it":"Remember: Deallocated means the virtual machine releases the physical hardware.

You only pay for storage, networking, and static IPs. The virtual machine status in the portal shows 'Stopped (deallocated)'. If it just says 'Stopped', it is still billed for compute."

Commonly Confused With

Azure virtual machinevsAzure App Service

Azure App Service is a Platform as a Service (PaaS) offering for hosting web apps, RESTful APIs, and mobile backends. You do not manage the underlying operating system or runtime. In contrast, an Azure virtual machine provides full control over the OS, but requires you to manage patching, updates, and security. App Service is simpler but less flexible.

If you want to host a simple Node.js website without worrying about server updates, choose App Service. If you need to install custom software or use a non-standard runtime, choose a virtual machine.

Azure virtual machinevsAzure Container Instances

Azure Container Instances (ACI) run containers directly, without the overhead of a full virtual machine. Containers share the host kernel and start in seconds. Virtual machines are heavier, take longer to boot, and provide a full OS isolation. Use containers for microservices and fast scaling; use virtual machines for monolithic apps or when you need OS-level access.

Deploy a single Docker container for a background job with ACI. Use a virtual machine to run a legacy Windows application that requires full OS customization.

Azure virtual machinevsAzure Virtual Desktop

Azure Virtual Desktop (AVD) is a desktop and app virtualization service that runs on Azure virtual machines. It provides multi-session Windows 10/11 desktops and remote apps. An Azure virtual machine is the underlying compute for AVD, but AVD adds a management layer for user assignment, scaling, and connectivity. The virtual machine itself is just a general-purpose IaaS resource.

Use AVD if you need to provide remote desktops to 100 employees. Use an individual virtual machine if you only need a single development server in the cloud.

Azure virtual machinevsAWS EC2 Instance

Amazon EC2 is the equivalent service on AWS. Both provide IaaS virtual machines with similar concepts: instance types, AMIs (Azure uses images), security groups (like NSGs), and elastic IPs (like public IPs). The main differences are in naming, pricing models, and integration with other services. EC2 uses EBS volumes for persistent storage (like Azure Managed Disks). Azure uses availability sets; AWS uses placement groups.

If you know how to launch an EC2 t2.micro instance in AWS, you can easily create a Standard_B1s virtual machine in Azure. The workflow is nearly identical.

Step-by-Step Breakdown

1

Choose the Region

Select the Azure region where your virtual machine will be hosted. Regions are geographic areas containing multiple data centers. Choose the region closest to your users or other Azure services to reduce latency. Some regions may have restrictions on certain virtual machine sizes.

2

Select the Virtual Machine Image

Pick an operating system image from the Azure Marketplace or use a custom image. The image includes the base OS and optional pre-installed software. Common choices are Windows Server 2022, Ubuntu Server, or Red Hat Enterprise Linux. Images are maintained by Microsoft or third-party vendors.

3

Choose the Virtual Machine Size (SKU)

Select a size that defines the number of vCPUs, RAM, temporary storage, and network bandwidth. Use the Azure size selector to match your workload. For example, general-purpose D-series for balanced CPU/memory, or memory-optimized E-series for databases. The size directly impacts performance and cost.

4

Configure Networking

Choose or create a virtual network (VNet) and subnet for your virtual machine. You can assign a public IP for inbound internet access or use only a private IP for internal communication. Configure Network Security Group (NSG) rules to control traffic. For example, allow RDP on port 3389 for Windows or SSH on port 22 for Linux.

5

Attach Storage

The OS disk is created automatically. You can attach additional managed data disks for applications and data. Choose the disk type (Premium SSD, Standard SSD, Standard HDD) based on performance needs. Enable disk encryption if required. Set the caching option for the OS disk to Read/Write or None depending on the workload.

6

Set Administrator Credentials

Provide a username and password or SSH public key for authentication. For Windows virtual machines, you can use password-based authentication. For Linux, using SSH keys is more secure. This credential is used to log in to the virtual machine after deployment.

7

Configure High Availability and Monitoring

Optionally place the virtual machine in an availability set or availability zone. Enable boot diagnostics for troubleshooting. Set up Azure Monitor to collect metrics and logs. You can also configure auto-shutdown to save costs. For production, consider using Azure Backup for VM-level backup.

8

Review and Deploy

Review all the configuration settings. Azure will validate the deployment and show estimated costs. Once you click 'Create', Azure provisions the virtual machine. This includes creating the NIC, disks, and the virtual machine object. The process typically takes a few minutes. After deployment, you can connect to the virtual machine using RDP or SSH.

Practical Mini-Lesson

When you deploy an Azure virtual machine, the first practical decision is choosing the right size. Many beginners select a size based on on-premises hardware they are familiar with, but cloud sizing is different. Azure virtual machines have different 'series' optimized for different workloads. The B-series (burstable) is great for low-traffic web servers that occasionally need extra CPU. The D-series is a balanced choice for most general-purpose applications. The E-series is memory-optimized, suitable for SQL Server or SAP. Always use Azure Advisor or cost management tools to get recommendations after deployment.

Storage configuration is another area where professionals must be careful. The OS disk should ideally be at least 127 GB (minimum for Windows) but you can expand it later. Data disks should be sized and tiered based on the IOPS and throughput your application needs. A common strategy is to separate application logs, database files, and tempdb onto different disks to avoid contention. For SQL Server, using Premium SSD with ReadOnly caching on the OS disk and None caching on data disks can significantly improve performance.

Networking in Azure virtual machines involves more than just attaching a public IP. You need to understand Azure DNS, internal name resolution, and network peering if you have multiple VNets. For security, always use NSGs with the principle of least privilege. Do not open RDP or SSH to the entire internet. Instead, use Azure Bastion or a jumpbox virtual machine in the same VNet. For applications that need to be exposed, consider using Azure Application Gateway or Azure Load Balancer in front of the virtual machines.

A critical operational task is patching. You must regularly update the operating system and applications inside the virtual machine. Azure offers Update Management in Azure Automation, but you can also use third-party tools. If you forget to patch, vulnerabilities can be exploited. Another common mistake is not enabling backups. Azure Backup provides simple, reliable virtual machine-level backups with application-consistent snapshots. Configure backup policies that align with your RPO and RTO.

Finally, cost optimization is a continuous activity. Use reserved instances for predictable workloads, set auto-shutdown for development environments, and consider spot virtual machines for batch processing. Monitor your spending with Azure Cost Management and set budgets and alerts. Remember that even when a virtual machine is deallocated, you still pay for managed disks and static public IPs. So remove unused public IPs to save money.

How Azure virtual machine Sizing and SKU Selection Works

Selecting the correct virtual machine size is one of the most critical decisions when deploying workloads in Azure. Azure virtual machines are grouped into families called SKUs, each optimized for different workloads: general purpose, compute optimized, memory optimized, storage optimized, GPU, and high-performance compute. General-purpose SKUs, such as the B-series burstable and D-series, offer a balanced CPU-to-memory ratio and are ideal for development, testing, and small-to-medium production workloads.

The B-series is unique because it allows CPU bursting-when your VM is idle, it accumulates credits, and when demand spikes, it can burst above its baseline. This is extremely cost-effective for workloads that are not consistently busy. Compute-optimized SKUs, like the F-series, provide a high CPU-to-memory ratio and are designed for batch processing, web servers, and network appliances.

Memory-optimized SKUs, like the E-series, have large memory footprints and are used for in-memory databases, data analytics, and SAP workloads. Storage-optimized SKUs, such as the L-series, provide high disk throughput and IOPS for big data and data warehousing. GPU SKUs, like the NC and NV series, are used for machine learning, rendering, and visualization.

High-performance compute SKUs, like the H-series, are designed for scientific simulations and financial modeling. When choosing a SKU, you must consider not only the workload type but also the regional availability, because not all SKUs are available in every Azure region. Another key factor is the number of vCPUs and memory needed; Azure also offers constrained vCPU sizes that allow you to reduce software licensing costs (e.

g., for SQL Server) by limiting the number of visible vCPUs while keeping the same memory. The Azure Pricing Calculator and the Azure VM Sizing tool help estimate costs and find the right size.

It is also important to understand that you can resize a VM to a different SKU, provided it is in the same hardware family and the target size is available in the region. However, resizing typically requires a reboot. To avoid downtime, consider using availability sets or availability zones, which are covered in other sections.

For exam preparation, you should be able to identify which SKU family matches a described workload scenario. For example, a scenario requiring high memory for an SAP HANA deployment points to the E-series, while a scenario needing GPU for deep learning points to the NC or NV series. Azure also recently introduced the NVv4 and NCsv3 series for specialized workloads.

The exam Azure Fundamentals requires basic understanding of these categories, while AZ-104 dives deeper into provisioning and management. The AWS and Google Cloud exams on your related list test similar concepts but with different naming conventions-AWS uses instance types like t3.micro or m5.

large, and Google Cloud uses machine families like N1, N2, and C2. The core principle remains: match the compute, memory, and I/O requirements to the right family. Remember that overprovisioning leads to unnecessary costs, while underprovisioning causes performance bottlenecks.

Azure also supports the use of Azure Dedicated Host, which gives you physical servers for compliance and licensing reasons, but this is a premium feature. For most scenarios, standard SKUs suffice. You should also be aware of the differences between Generation 1 and Generation 2 VMs: Generation 2 supports larger memory (up to 12 TB), secure boot, and UEFI, while Generation 1 is limited to 3.

75 GB per vCPU. New workloads should prefer Generation 2, but some legacy operating systems only support Generation 1. In the Azure portal, when creating a VM, you select the image, then the size, and you can filter by family.

It is recommended to use Azure CLI or PowerShell for automation, which we cover in the command examples section. Understanding the pricing model for SKUs is also vital: you pay per second for compute time, and you can choose pay-as-you-go or reserved instances. Reserved instances provide significant discounts for one- or three-year commitments.

There are also spot VMs, which offer deep discounts but can be evicted when Azure needs capacity back. Spot VMs are ideal for batch jobs, dev/test, and stateless workloads. Sizing and SKU selection is not just about picking a size-it is about aligning workload characteristics with Azure's diverse compute portfolio to optimize both performance and cost.

This knowledge is tested directly in scenario-based questions on the exam.

Understanding Azure virtual machine States and Lifecycle Management

Azure virtual machines have a well-defined lifecycle that consists of several states: Provisioning, Running, Stopped, Stopped (Deallocated), and Failed. Understanding these states is critical for cost management, troubleshooting, and exam success. When you first create a VM, it enters the Provisioning state.

During this phase, Azure allocates the underlying hardware, configures the virtual network interfaces, attaches disks, and applies any extensions. The VM is not yet billable for compute costs, but storage costs for the OS disk and data disks accumulate from the moment they are created. Once provisioning completes successfully, the VM transitions to the Running state.

In this state, the VM is fully operational, and you are billed for compute time, storage, and any reserved IP addresses. The Running state also includes various substates such as Updating, Starting, and Stopping, which are transient. The most important distinction for cost purposes is between Stopped and Stopped (Deallocated).

When you stop a VM from the Azure portal or using the Stop-AzVM PowerShell cmdlet with the -StayProvisioned flag, the VM enters the Stopped state. In this state, the VM is powered off but still retains its allocated hardware resources (vCPUs, memory, public IP, etc.).

You are still billed for compute because the resources are reserved for you. This is useful if you need to quickly restart the VM without waiting for a new allocation. However, the standard Stop VM action in the portal or via the CLI (az vm stop) actually deallocates the VM by default, moving it to the Stopped (Deallocated) state.

In this state, the hardware resources are released back to Azure, and you are not billed for compute. You are only billed for the storage disks, static public IP if assigned, and any attached managed disks. This is the most cost-effective way to pause a VM for extended periods, such as nightly shutdowns for dev/test environments.

The deallocation also frees up the public IP unless it is set to static, and the private IP may change if you aren't using a static private IP. When you start the VM again, Azure allocates new hardware, which may be in a different host but in the same region. This can lead to a slightly different performance profile due to noisy neighbors, but for most workloads it is acceptable.

Another state is Failed, which indicates a provisioning or allocation failure. This can happen if the Azure region runs out of capacity for the chosen SKU, a quota limit is exceeded, or the image is corrupted. In such cases, you may need to retry with a different size or region.

The lifecycle also includes actions like restart, which cycles the guest OS, and reapply, which refreshes the VM model without deallocation. For high availability, you can use availability sets or availability zones. An availability set spreads VMs across fault domains and update domains to protect against hardware failures and planned maintenance.

Availability zones are physically separate data centers within a region. When a VM is in a Stopped (Deallocated) state, it is important to note that the underlying host may be assigned to another customer, and when you restart, it might land on a different host that could affect performance if the workload is latency-sensitive. For exam scenarios, you may be asked to identify which state incurs compute charges.

The answer is Running and Stopped (without deallocation). The Stopped (Deallocated) state does not incur compute charges. Questions often revolve around cost optimization, such as recommending that administrators deallocate VMs during non-business hours.

Another common exam topic is the difference between stopping and deallocating when using Azure Automation runbooks. Also, remember that the billing for a static public IP address continues even when the VM is deallocated. You can release the IP by disassociating it or using a dynamic IP.

The VM lifecycle also ties into Azure Backup; backups only of the disk are taken regardless of VM state, but the application-consistent restore may require the VM to be running. Lifecycle management is a fundamental concept that directly impacts cost and operational efficiency, and it is a frequent topic in all related exams, especially AZ-104 and Azure Fundamentals.

How Azure virtual machine Networking and Connectivity Works

Networking is an integral part of Azure virtual machine deployment because a VM without network connectivity is effectively isolated. Every Azure VM is attached to a virtual network (VNet) through a virtual network interface card (NIC). You can attach multiple NICs to a single VM, which is useful for network virtual appliances or when you need to separate management traffic from data traffic.

Each NIC is associated with a subnet within a VNet, and that subnet must have an address range that does not overlap with other networks. IP addressing is a critical concept: each NIC can have one private IP address by default (which can be static or dynamic) and optionally one or more public IP addresses. A dynamic private IP is assigned when the VM is started and may change after a deallocation.

A static private IP remains assigned even when the VM is stopped (deallocated) and is essential for services that rely on a fixed IP, such as DNS servers or domain controllers. Public IP addresses can also be dynamic or static. Dynamic public IPs can change after a VM restart or deallocation, while static public IPs remain until explicitly released.

For both exam and real-world scenarios, you must understand that you are billed for a static public IP even when the VM is deallocated, whereas a dynamic public IP does not incur charges when not in use. Network security groups (NSGs) are the primary tool for filtering inbound and outbound traffic to a VM. An NSG is a set of rules that allow or deny traffic based on source/destination IP, port, and protocol.

An NSG can be associated at the subnet level or at the NIC level. When both levels are applied, the rules are evaluated in order of priority, and a deny rule at any level will block traffic. For example, if you have a web server on port 80, you must create an inbound rule allowing TCP port 80 from the internet.

By default, all inbound traffic is denied, and outbound traffic is allowed. On the exam, you may be given a scenario where administrators cannot RDP or SSH into a VM; the first step is to check the NSG rules. Another networking feature is Azure Load Balancer, which distributes incoming traffic across multiple VMs for high availability.

There are two tiers: Basic and Standard. Standard Load Balancer offers more features such as zone-redundancy and outbound rules. You can also use Application Gateway, which is an L7 load balancer that performs SSL termination and URL-based routing.

For DNS, Azure provides automatic DNS resolution for VMs within the same VNet, and you can use custom DNS servers if needed. Private Link allows you to connect to Azure PaaS services (like Azure SQL Database) via a private IP within your VNet, eliminating exposure to the public internet. For hybrid connectivity, Azure provides VPN Gateway and Azure ExpressRoute.

VPN Gateway establishes site-to-site or point-to-site connections over the internet, while ExpressRoute provides a dedicated private connection to Azure. When you create a VM, the default outbound connectivity is provided through SNAT (source network address translation) using a public IP assigned to the VM or through Azure's default outbound access. For production workloads, it is recommended to use a standard public IP and a NAT gateway to avoid dependency on default outbound access, which can be unreliable.

A related exam topic is Accelerated Networking, which uses SR-IOV to bypass the host virtualization and provide lower latency and higher throughput. This is available for most VM sizes and must be enabled during VM creation or via PowerShell. It is especially important for high-performance computing and network-intensive workloads.

Azure VM networking involves understanding IP addressing, NSGs, load balancers, and connectivity options that are all tested in the AZ-104 and Azure Fundamentals exams. AWS and Google Cloud exams also have similar networking concepts but with different service names (e.g.

, AWS Security Groups and VPC, Google Cloud Firewall Rules and VPC). The key exam advice is to always check NSG rules first when connectivity fails, and to understand the cost implications of static vs. dynamic IPs.

Deep Dive into Azure virtual machine Storage and Managed Disks

Storage is a foundational component of any Azure virtual machine, and understanding disk types, performance tiers, and redundancy options is essential for both real-world deployments and exam success. Every Azure VM requires at least one OS disk, and you can attach multiple data disks. Azure offers two main categories of disks: managed disks and unmanaged disks.

Managed disks are the recommended option because they abstract away the storage account management, provide built-in redundancy, and offer granular performance tiers. Unmanaged disks are legacy and require you to create and manage your own storage accounts. For all current exams, the focus is on managed disks.

Managed disks come in four performance types: Ultra Disk, Premium SSD v2, Premium SSD, Standard SSD, and Standard HDD. Ultra Disk offers the highest performance with sub-millisecond latency and customizable IOPS and throughput, making it suitable for latency-sensitive workloads like SAP HANA and high-end databases. Premium SSD v2 is the latest generation, offering better cost efficiency than Premium SSD with the ability to independently scale IOPS and throughput.

Premium SSD provides high performance for production workloads with consistent IOPS and latency. Standard SSD is for workloads that need consistent performance but not the high end of premium, such as web servers and dev/test environments. Standard HDD is for workloads that are latency-tolerant and used for backup, archival, and infrequent data access.

When configuring a disk, you must choose a size that determines not only capacity but also the baseline IOPS and throughput. For example, a P10 Premium SSD (128 GB) gives you 500 IOPS and 100 MB/s throughput, while a P50 (4096 GB) gives you 7500 IOPS and 250 MB/s throughput. For Ultra Disk, you can set your own IOPS and throughput up to the VM size limits.

Caching is another important concept. Azure supports ReadOnly and ReadWrite caching for disks. The OS disk typically uses ReadWrite caching to improve read and write performance for the operating system.

Data disks can use ReadOnly caching for data that is frequently read and infrequently written, such as database log files. The caching is applied at the host level and uses a portion of the VM's local memory. For write-heavy workloads, you might disable caching to avoid cache pollution.

The caching type can only be set when the disk is attached or offline. Another critical storage feature is Azure Disk Encryption, which uses BitLocker for Windows and DM-Crypt for Linux to encrypt the entire OS and data disks at rest. This is often required for compliance and security policies.

Azure Disk Encryption uses Azure Key Vault to store encryption keys, and you can choose to encrypt using platform-managed keys or customer-managed keys. The exam frequently tests that encryption can be enabled during VM creation or later via PowerShell and that it requires the Azure Disk Encryption extension to be installed. Backup and disaster recovery are also part of storage management.

Azure Backup can backup VM data and configuration to a Recovery Services vault, and you can restore to a specific point in time. Azure Site Recovery provides replication to another region for disaster recovery. Both of these services are a part of the exam objectives.

Data disk attachment and detachment is possible while the VM is running, as long as the disk is a managed disk and the VM supports hot attach. This allows you to scale storage without downtime. However, the OS disk cannot be detached while the VM is running.

You can also resize a managed disk without deallocating the VM for most disk types, but you may need to extend the volume in the guest OS. Shared disks are another advanced feature that allows multiple VMs to simultaneously read and write to the same disk, useful for clustering applications like SQL Server Failover Cluster Instances. Latency, however, increases with shared disks.

Storage performance and costs are a major part of Azure VM design. You must know the differences between disk types, how caching affects performance, and how to encrypt and backup disks. The exam expects you to recommend the correct disk type based on a workload scenario, such as using Premium SSD for a production database and Standard HDD for archival logs.

AWS equivalents are EBS volumes (gp2, gp3, io1, io2, st1, sc1), while Google Cloud uses persistent disks (pd-standard, pd-balanced, pd-ssd, pd-extreme). The key exam takeaway is: for high IOPS, choose Ultra Disk or Premium SSD; for general purpose, choose Premium SSD v2 or Standard SSD; for cost-sensitive, choose Standard HDD.

Troubleshooting Clues

Cannot RDP or SSH to Azure VM

Symptom: Connection timeout or access denied after several attempts

Most commonly, the inbound NSG rule for port 3389 (RDP) or port 22 (SSH) is missing or blocked. Also, the VM may be stopped (deallocated) or the guest OS firewall may be blocking the port. The public IP may have changed if it was dynamic and the VM was deallocated and restarted.

Exam clue: Exam scenarios often present a user unable to connect; the first step to diagnose is checking NSG rules and VM status. Also test whether the VM is running.

VM provisioning stuck in 'Creating' or 'Updating' state

Symptom: A new VM creation remains in provisioning state for more than 10 minutes, or a resize operation hangs

This often happens due to regional capacity constraints for the chosen SKU or a quota limit on the subscription. It can also be caused by a faulty custom image or corruption in the OS disk. The VM may eventually fail with an allocation failure.

Exam clue: Exams test allocation failures; the solution is to try a different VM size or region. Also, using Azure Reserved Instances does not guarantee capacity-use capacity reservations for that.

High CPU or memory latency on VM

Symptom: VM performance is slower than expected for the SKU, applications time out

This can be due to resource contention on the underlying hypervisor (noisy neighbors), but often it is because the VM size is undersized for the workload. Also, caching settings on disks might be misconfigured (e.g., read-write cache on a write-heavy database disk causing bottlenecks).

Exam clue: Exams ask to analyze performance issues; the solution is to monitor metrics with Azure Monitor, then resize or change disk caching to None. Also check if VM is using a burstable SKU that has exhausted its CPU credits.

VM cannot connect to on-premises network after site-to-site VPN setup

Symptom: VMs in Azure cannot ping on-premises resources, or vice versa

The most common reason is that the route tables on either side are incorrect, or the VPN gateway is not properly configured. Also, the on-premises firewall may block traffic from Azure IP ranges. Another cause is that the local network gateway IP address is outdated or wrong.

Exam clue: This is a classic hybrid connectivity scenario; the exam expects you to check the Azure VPN gateway status, route tables, and ensure that the local network gateway has the correct on-premises prefix and public IP.

Disk IOPS lower than expected

Symptom: Database performance is poor; disk queue length is high

The disk IOPS are capped by the disk size and type. For Premium SSD, each disk size has a baseline IOPS. The VM size also limits the maximum IOPS it can push to a disk. For example, a Standard_D2s_v3 can only support a limited number of IOPS even if the disk can do more. Also, caching may affect IOPS.

Exam clue: Exams ask about IOPS limitations; you need to ensure that the VM size supports the disk's max IOPS. Also understand that Ultra Disk lifts many of these constraints but requires a compatible VM size.

VM stuck on 'Stopping' or 'Starting' for extended time

Symptom: The VM takes more than 15 minutes to stop or start, or the status remains in transitional states

This can happen if the VM has pending updates that are installed during shutdown, or if there is a faulty extension hanging the shutdown sequence. Also, a large number of attached disks can increase the time. Sometimes a forced shutdown from the portal is needed.

Exam clue: Exam scenarios test the difference between graceful shutdown and forced shutdown. Azure performs a graceful shutdown by default; if it takes too long, you can use the 'az vm stop --force' option, but that may lead to data loss.

Custom script extension fails to run

Symptom: VM provisioned but the script did not execute, or it failed with error in the Azure portal

The script extension may have been configured with incorrect parameters, or the script itself has syntax errors. Also, the network connectivity from the VM to the script storage location (e.g., Azure Blob Storage) may be blocked by an NSG. The extension also requires that the VM agent (Windows Azure Guest Agent or Linux Agent) is running.

Exam clue: Exams test the dependency of extensions on the VM agent. If the agent is not running, the extension will fail. Also, you must enable managed identity or provide SAS tokens for secure access to script storage.

Memory Tip

Use the mnemonic "RSIC" to remember the four key virtual machine considerations: Region, Size, Image, and Cost.

Learn This Topic Fully

This glossary page explains what Azure virtual machine means. For a complete lesson with labs and practice, see the topic guide.

Covered in These Exams

Current Exam Context

Current exam versions that test this topic — use these objectives when studying.

Related Glossary Terms

Quick Knowledge Check

1.You have an Azure VM that runs a critical database. The VM is currently in the 'Running' state. You need to reduce costs without impacting the VM's availability. Which action should you take?

2.A junior administrator tries to RDP into an Azure VM but gets a timeout error. The VM is running and has a public IP address. What is the most likely cause?

3.Which Azure VM SKU family is specifically designed for workloads that require the highest memory-to-vCPU ratio, such as large in-memory databases?

4.You need to ensure that when two VMs are placed in the same availability set, they are guaranteed to be on different hardware racks to protect against rack-level failures. Which concept does this describe?

5.An administrator receives a notification that a VM's disk performance is below expected IOPS. The VM is a Standard_D4s_v3 with a Premium SSD P30 disk (5000 IOPS at rest). What is a likely reason for the performance shortfall?

6.You attempt to create a new Azure VM in the East US region using the Standard_DS3_v2 SKU, but the creation fails with an 'AllocationFailure' error. What is the best course of action?

Frequently Asked Questions

Can I change the virtual machine size after deployment?

Yes, you can resize an Azure virtual machine as long as the new size is available in the same hardware cluster. The virtual machine may need to restart. Some combinations of series (e.g., changing from D-series to E-series) are not allowed because they run on different hardware generations.

What is the difference between a stopped and a deallocated virtual machine?

A stopped virtual machine (when you shut down from within the OS) is still allocated to the physical host, and you continue to pay for compute. A deallocated virtual machine releases the host resources, and you only pay for storage and networking. Always use the Azure portal to stop (deallocate) for cost savings.

Can I use my own operating system license with Azure virtual machines?

Yes, you can use Azure Hybrid Benefit to apply your existing Windows Server or SQL Server licenses with Software Assurance to reduce costs. For Linux, you can bring your own subscription-based images from the marketplace or build custom images.

How do I connect to an Azure virtual machine without a public IP?

You can use Azure Bastion, which provides secure RDP and SSH access through the Azure portal over SSL. Alternatively, you can set up a jumpbox virtual machine in the same VNet, or use Azure Point-to-Site VPN to connect to your VNet from your local machine.

What happens to my data if I delete a virtual machine?

By default, the OS disk and data disks are not automatically deleted when you delete a virtual machine. You must explicitly delete them from the Azure portal if you want to remove them. If you delete the disk, all data is lost unless you have a backup.

How does Azure ensure high availability for virtual machines?

For high availability within a region, you use an availability set (distributes VMs across fault domains and update domains) or availability zones (physical separate data centers). For disaster recovery across regions, you use Azure Site Recovery to replicate VMs.

What is a virtual machine scale set?

A virtual machine scale set is a group of identical, load-balanced virtual machines that can automatically increase or decrease in number based on demand or a schedule. It simplifies running large-scale applications and provides high availability.

Summary

An Azure virtual machine is a foundational cloud computing resource that emulates a physical computer in Microsoft's data centers. It gives you full control over the operating system, applications, and data while Microsoft handles the underlying hardware. This IaaS model is essential for migrating legacy applications, testing software, and handling variable workloads without large upfront investments.

Understanding Azure virtual machines is critical for IT certification exams like AZ-900 and AZ-104, as well as for any cloud-related role. You need to grasp sizing, storage, networking, availability, and cost optimization. Common mistakes like leaving VMs running unnecessarily, misconfiguring security groups, or using temporary storage for persistent data can lead to high bills or security incidents.

On exams, you will face scenario questions that ask you to choose the right virtual machine size, deploy for high availability, or troubleshoot connectivity. Mastering this concept will help you answer both multiple-choice and case study questions confidently. Remember that Azure virtual machines are just one part of the compute landscape, alongside containers, serverless, and PaaS services. The key takeaway is to know when to use a virtual machine and how to configure it efficiently and securely.