Azure Documentation

Virtual Machines: Managing Resources

Manage Your Azure Virtual Machines

This guide provides comprehensive instructions on managing your Azure Virtual Machines (VMs) throughout their lifecycle. Effective management ensures optimal performance, security, and cost-efficiency for your cloud resources.

Starting, Stopping, and Restarting VMs

You can easily control the power state of your VMs through the Azure portal, Azure CLI, or PowerShell.

To deallocate a VM:

az vm deallocate --resource-group MyResourceGroup --name MyVM

Resizing Virtual Machines

You can change the size of your VM to accommodate changes in workload demands. This typically involves stopping and deallocating the VM, changing its size, and then starting it again.

Steps to Resize:

  1. Navigate to your VM in the Azure portal.
  2. Under "Settings", select "Size".
  3. Choose a new VM size from the available options.
  4. Click "Resize".
Azure VM Size Selection Example
Example of selecting a new size for an Azure VM.

Connecting to Your VM

Securely connect to your VM using Remote Desktop Protocol (RDP) for Windows or SSH for Linux.

Windows VMs:

  1. In the Azure portal, go to your VM's overview page.
  2. Click "Connect" and select "RDP".
  3. Download the RDP file and connect using your VM's administrator credentials.

Linux VMs:

  1. In the Azure portal, go to your VM's overview page.
  2. Click "Connect" and select "SSH".
  3. Use the provided command in your terminal, e.g.:
    ssh azureuser@13.91.12.135
Tip: For enhanced security, consider using Azure Bastion for connection instead of direct public IP access.

Managing Disks

Azure VMs utilize managed disks for storing operating system and data. You can attach, detach, and manage these disks.

Common Disk Operations:

Monitoring VM Performance

Keep track of your VM's health and performance metrics using Azure Monitor.

Azure VM Monitoring Dashboard Example
An example of the Azure Monitor dashboard for a virtual machine.

Cost Management

Optimize your VM spending by following these practices:

Note: Deallocating a VM stops compute charges, but storage charges for disks and other associated resources will continue.