Skip to main content

Introduction to Azure Virtual Machines

Migrating on-premises servers to Azure requires planning and attention. You can move everything at once, but it's typically done in phases or even one by one. Before creating a VM, you need to map out your current infrastructure and how it aligns with the cloud model.


VMs in Azure involve several key components:

  • Disks for storage
  • Virtual networks
  • Network interfaces
  • Network Security Groups (NSG)
  • IP addresses (public, private, or both)
info

Azure will create these resources if needed, or you can use existing ones.
Azure will use the VM name as the base for automatically naming associated resources during VM creation.


VM Resource Details


Networking

VNets (Virtual Networks) in Azure are used for private connectivity between VMs and other Azure services.

  • Define address space and subnets
  • Avoid overlaps with your on-premises network
  • Use private IP ranges like:
    • 10.0.0.0/8
    • 172.16.0.0/12
    • 192.168.0.0/16

Subnetting

Example:

  • 10.1.0.0 for VMs
  • 10.2.0.0 for backend
  • 10.3.0.0 for SQL Server

Note: Azure reserves the first 4 and last IP address in each subnet.

Security

Use NSG (Network Security Group) to:

  • Control inbound and outbound traffic
  • Restrict access to specific ports

VM Planning

VM Naming

The VM name is used as the computer name:

  • Linux: up to 64 characters
  • Windows: up to 15 characters

Use naming conventions:

ElementExampleNotes
Environmentdev, prod, QAIndicates environment
Locationeus, jwAzure region
Instance01, 02If multiple VMs
ServiceserviceApplication/product name
Rolesql, webVM function

Example: deveus-webvm01 → First web server for dev in East US.

VM Location

Choose an Azure region (e.g., West US, Southeast Asia)

Consider:

  • Proximity to users
  • Legal or tax regulations
  • Performance
  • Pricing (varies by region)

Choose VM Size

Azure offers a variety of VM sizes based on workload needs:

TypeDescription
General purposeBalanced CPU-to-memory ratio. For dev/test, small DBs, light web servers
Compute optimizedHigh CPU. Suitable for medium web servers, batch jobs, network appliances
Memory optimizedHigh memory. Great for relational DBs, caching, in-memory analytics
Storage optimizedHigh disk throughput. Ideal for large DBs
GPUGraphics rendering, AI training & inference
High performance computeFastest CPUs, high network throughput

Note: Resizing is possible, but the VM will reboot.


VM Components and Cost

ResourceDescriptionCost
Virtual NetworkFor VM communicationVNet pricing applies
NICConnects to VNetFree (with limits)
IP AddressPublic or privateIP pricing applies
NSGSoftware-based firewallFree
OS & Data DisksSeparate data from OSDepends on disk type
OS LicenseWindows/LinuxDiscounted with Hybrid Benefit

💡 Tip: Stopped and deallocated VMs are only charged for storage, not compute.


Azure Pricing Models

Compute Cost

  • Billed per hour, charged per minute
  • No charges if VM is deallocated

Payment Options:

OptionDescription
Pay as you goFlexible, per-second billing, no commitment
Reserved Instance1 or 3-year commitment, up to 72% cost savings

Storage Cost

  • Charged even when VM is shut down
  • Separate data disks for independent management
  • Max number of disks depends on vCPU count

Disk Types:

Disk TypeUse CaseMax IOPSThroughputOS Disk?
Ultra DiskHigh IO load (SAP, SQL)160,0004,000 MB/s
Premium SSD v2Performance-sensitive apps80,0001,200 MB/s
Premium SSDProduction use20,000900 MB/s
Standard SSDWeb server, dev/test6,000750 MB/s
Standard HDDBackup, infrequent access2,000500 MB/s

Choose Operating System

Azure provides a wide range of OS images, including Linux and Windows.

  • Pricing can be affected by OS
  • Use the Marketplace for ready-made images (e.g., WordPress stack)
  • Or create a custom image stored in the Azure Compute Gallery

Info

This checklist helps you design a VM in Azure considering:

✅ Networking
✅ VM Size
✅ Location
✅ Operating System
✅ Pricing Model

So your solution fits both technical needs and budget.


Options to Create and Manage Azure Virtual Machines

Azure provides multiple ways to create and manage VMs. Here are popular methods:

Azure Portal

The most beginner-friendly way to create a VM. However, it becomes inefficient for complex scenarios or bulk VM creation.

Azure Resource Manager (ARM) Templates

ARM templates are JSON files that define needed resources. You can export from an existing VM, edit, and reuse them.

  • Ideal for consistent environments (staging, production)
  • Supports parameters (VM name, network name, etc.)

See: Quickstart: Create Linux VM using ARM Template

Azure CLI

Azure CLI is Microsoft’s cross-platform command-line tool.

Example:

az vm create   --resource-group TestResourceGroup   --name test-wp1-eus-vm   --image Ubuntu2204   --admin-username azureuser   --generate-ssh-keys

See: Quickstart: Create Linux VM using CLI

Azure PowerShell

Great for interactive tasks or automation.

Example:

New-AzVm `
-ResourceGroupName "TestResourceGroup" `
-Name "test-wp1-eus-vm" `
-Location "East US" `
-Image Debian11 `
-VirtualNetworkName "test-wp1-eus-network" `
-SubnetName "default" `
-SecurityGroupName "test-wp1-eus-nsg" `
-PublicIpAddressName "test-wp1-eus-pubip" `
-GenerateSshKey `
-SshKeyName myPSKey `
-OpenPorts 22

See: Quickstart: Create Linux VM using PowerShell

Terraform

Terraform allows you to define, preview, and deploy cloud infrastructure using HCL configuration files.

See: Azure Terraform Provider

Azure REST API

Provides programmatic control over Azure resources, including VMs.

  • HTTP methods: GET, PUT, POST, DELETE, PATCH
  • Use for complex scenarios within your applications

See: Azure VM REST API Reference

Azure Client SDKs

Azure SDKs simplify interaction with REST APIs and are available for:

  • C# / .NET
  • Java
  • Python
  • Node.js
  • PHP
  • Go

Azure VM Extensions

VM extensions are small apps that help configure and automate post-deployment tasks on VMs.

See: Azure VM Extensions Overview

Azure Automation

Automation services reduce error and improve efficiency:

  • Process Automation – Trigger tasks on events
  • Configuration Management – Monitor & manage software configs
  • Update Management – Schedule and control OS updates

See: Azure Automation Overview

Auto-shutdown

This feature lets you schedule automatic shutdown of VMs to save costs.

  • Available in the Azure VM portal → "Operations" → "Auto-shutdown"

See: Azure VM Auto-shutdown