Azure Virtual Machines (VMs)
Azure Virtual Machines provide on-demand, scalable computing resources. You can use VMs to deploy and run applications that include virtualized servers, storage, and networking. Azure offers a wide variety of VM configurations to meet your performance, memory, and storage needs.
Key Concepts
VM Sizes
Azure offers a broad range of VM sizes optimized for different workloads. These sizes are grouped into families such as:
- General Purpose: Balanced CPU-to-memory ratio. Ideal for testing, development, small to medium databases, and web servers. (e.g., D-series, B-series)
- Compute Optimized: High CPU-to-memory ratio. Suitable for high-performance, batch processing, web servers, and application servers. (e.g., F-series, E-series)
- Memory Optimized: High memory-to-CPU ratio. Best for relational databases, caching, and in-memory analytics. (e.g., E-series, M-series)
- Storage Optimized: High disk throughput and IOPS. Designed for Big Data, SQL, and NoSQL databases. (e.g., L-series)
- GPU Optimized: Accelerated computing for graphics rendering, video editing, and machine learning. (e.g., N-series)
Images
You can deploy VMs from a variety of operating system images, including:
- Windows Server: Latest versions and earlier releases.
- Linux: Popular distributions like Ubuntu, CentOS, Red Hat Enterprise Linux, SUSE Linux Enterprise Server, and Debian.
- Marketplace Images: Pre-configured images with popular software stacks and applications.
Disks
Azure VMs use virtual hard disks (VHDs) to store operating systems, applications, and data. There are two main types of disks:
- OS Disk: The disk that contains the operating system.
- Data Disks: Additional disks for storing application data.
Disk types include:
- Standard HDD: Cost-effective for development/test, non-critical workloads.
- Standard SSD: Consistent performance for web servers, lightly-used enterprise applications, and development/test environments.
- Premium SSD: High-performance, low-latency storage for I/O-intensive workloads like production databases and critical applications.
- Ultra Disk: Highest performance, configurable IOPS and throughput, for demanding workloads like SAP HANA.
Common Operations
Creating a VM
You can create an Azure VM using the Azure portal, Azure CLI, Azure PowerShell, or ARM templates.
Example using Azure CLI:
az vm create \
--resource-group MyResourceGroup \
--name MyVM \
--image UbuntuLTS \
--admin-username azureuser \
--admin-password 'MyComplexPassword!123' \
--size Standard_DS1_v2 \
--location eastus
Connecting to a VM
For Windows VMs: Use Remote Desktop Protocol (RDP). Connect to the VM's public IP address.
For Linux VMs: Use SSH. Connect to the VM's public IP address on port 22.
ssh azureuser@<public_ip_address>
Managing VM State
You can start, stop, deallocate, and restart VMs to manage costs and resources.
- Stop (Deallocate): Releases the compute resources and stops billing for compute. Storage is still billed.
- Stop: Stops the VM but doesn't release compute resources, so you continue to be billed for compute.
Networking for VMs
VMs are typically deployed within an Azure Virtual Network (VNet). Network Security Groups (NSGs) are used to control inbound and outbound network traffic to VM network interfaces, subnets, and network interfaces.
Best Practices
- Choose the appropriate VM size and disk type for your workload.
- Implement robust security measures, including NSGs, firewalls, and patching.
- Use availability sets and availability zones for high availability.
- Regularly back up your VMs using Azure Backup.
- Monitor VM performance and resource utilization.
- Deallocate VMs when not in use to save costs.
Next Steps
Explore Azure Virtual Machine Scale Sets for automatically managing and scaling a group of identical VMs.
Learn about Azure Hybrid Benefit for cost savings when using existing on-premises Windows Server licenses.