🚀 Guide for Migrating Azure OS-Disks: Act Now – Standard HDD Support Ends by 2028!

Guide for Migrating Azure OS-Disks from Standard HDD to Standard SSD

 

Guide for Migrating Azure OS-Disks from Standard HDD to Standard SSD

Overview: Why Do This?

Microsoft has announced that Standard HDD will no longer be supported as OS-disks (boot volumes for virtual machines) in Azure after September 8, 2028. After this date, these disks will be automatically converted to Standard SSD of the same size, which may cause disruptions if not planned in advance. Standard SSD offers better performance and reliability than Standard HDD, though it may incur slightly higher costs. Migrating proactively avoids issues and improves virtual machine (VM) performance. Important: This applies only to OS-disks, not data disks or ephemeral disks. The migration process does not cause data loss if done correctly.

Key Prerequisites

  • Plan a maintenance window: Migration requires stopping the VM, causing downtime.
  • Ensure the disk is managed: If your disk is unmanaged, convert it to a managed disk first using CLI or PowerShell (see Microsoft’s documentation).
  • Limit of two changes per day: Azure allows only two disk type changes per disk per day.
  • Costs: Standard SSD is slightly more expensive than Standard HDD. Check pricing at Azure Disk Storage Pricing.

Four Methods to Migrate the OS-Disk

1️⃣ Method 1: Via Azure Portal (Simplest, Manual)

This method is ideal for small environments or users who prefer a graphical interface.

  1. Log in to Azure Portal: Go to portal.azure.com.
  2. Locate your VM: Navigate to "Virtual Machines" and select the VM with the OS-disk to migrate.
  3. Stop the VM: Click "Stop" to stop and deallocate the VM.
  4. Access the disk: Go to the VM’s "Disks" section and select the OS-disk.
  5. Change disk type: Under "Size + performance", set "Account type" to Standard SSD (locally-redundant storage) or StandardSSD_LRS.
  6. Save changes: Click "Save". The change typically takes less than a minute.
  7. Start the VM: Return to the VM’s overview page and click "Start".

Pros: Simple, no coding required.
Cons: Manual process, time-consuming for multiple VMs.

2️⃣ Method 2: Via Azure PowerShell (Single VM, Automated)

This method is suitable for automating migration of a single VM’s OS-disk and includes dynamic VM detection for flexibility.

PowerShell Script for Single VM

# Log in to Azure
Connect-AzAccount

# Define variables
$diskName = "yourDisk"              # Name of the OS-disk
$rgName = "yourResourceGroup"       # Resource group name
$vmName = "yourVM"                  # VM name
$storageType = "StandardSSD_LRS"    # Disk type, can be changed to e.g., Premium_LRS if VM size supports it

# Get the disk
$disk = Get-AzDisk -DiskName $diskName -ResourceGroupName $rgName

# Get the VM resource associated with the disk
$vmResource = Get-AzResource -ResourceId $disk.ManagedBy

# Stop and deallocate the VM
Stop-AzVM -ResourceGroupName $vmResource.ResourceGroupName -Name $vmResource.Name -Force

# Update disk type
$disk.Sku = [Microsoft.Azure.Management.Compute.Models.DiskSku]::new($storageType)
Update-AzDisk -ResourceGroupName $rgName -Disk $disk -DiskName $diskName

# Start the VM
Start-AzVM -ResourceGroupName $vmResource.ResourceGroupName -Name $vmResource.Name
    

Instructions:

  1. Replace yourDisk, yourResourceGroup, and yourVM with your values. Find these in the Azure Portal under the VM’s "Disks" and "Overview" sections.
  2. If switching to another disk type (e.g., Premium_LRS), update $storageType and ensure the VM size supports it (e.g., DS-series for Premium SSD).
  3. Run the script in Azure Cloud Shell (PowerShell) or a local PowerShell environment with Azure modules installed.

Pros: Fast and flexible for a single VM.
Cons: Requires some PowerShell familiarity; not ideal for multiple VMs.

3️⃣ Method 3: Via Azure PowerShell (Multiple VMs, Automated)

This method automates migration for all VMs in a resource group, updating their OS-disks to Standard SSD. It’s ideal for managing multiple VMs efficiently.

PowerShell Script for Multiple VMs

# Log in to Azure
Connect-AzAccount

# Define variables
$rgName = "yourResourceGroup"       # Resource group name
$storageType = "StandardSSD_LRS"    # Disk type, can be changed to e.g., Premium_LRS if VM size supports it

# Get all VMs in the resource group
$vms = Get-AzVM -ResourceGroupName $rgName

foreach ($vm in $vms) {
    # Stop and deallocate the VM
    Write-Output "Stopping VM: $($vm.Name)"
    Stop-AzVM -ResourceGroupName $rgName -Name $vm.Name -Force

    # Get the OS-disk for the VM
    $disk = Get-AzDisk -ResourceGroupName $rgName -DiskName $vm.StorageProfile.OsDisk.Name

    # Check if the disk is already Standard SSD
    if ($disk.Sku.Name -ne "StandardSSD_LRS") {
        Write-Output "Updating OS-disk $($disk.Name) to $storageType"
        $disk.Sku = [Microsoft.Azure.Management.Compute.Models.DiskSku]::new($storageType)
        Update-AzDisk -ResourceGroupName $rgName -Disk $disk -DiskName $disk.Name
    } else {
        Write-Output "OS-disk $($disk.Name) is already $storageType, skipping"
    }

    # Start the VM
    Write-Output "Starting VM: $($vm.Name)"
    Start-AzVM -ResourceGroupName $rgName -Name $vm.Name
}
    

Instructions:

  1. Replace yourResourceGroup with your resource group name, found in the Azure Portal.
  2. If switching to another disk type (e.g., Premium_LRS), update $storageType and ensure all VM sizes support it (e.g., DS-series for Premium SSD).
  3. Run the script in Azure Cloud Shell (PowerShell) or a local PowerShell environment with Azure modules installed.
  4. The script checks if the disk is already Standard SSD to avoid unnecessary updates.

Pros: Efficient for multiple VMs; includes logging and checks to prevent redundant updates.
Cons: Requires PowerShell familiarity; ensure all VMs support the target disk type.

4️⃣ Method 4: Via Azure CLI (Single VM, Automated, Cross-Platform)

This method is great for users preferring CLI or working in non-Windows environments.

Azure CLI Commands

# Log in to Azure
az login

# Stop the VM
az vm deallocate --resource-group "yourResourceGroup" --name "yourVM"

# Update the disk to Standard SSD
az disk update --resource-group "yourResourceGroup" --name "yourDisk" --sku StandardSSD_LRS

# Start the VM
az vm start --resource-group "yourResourceGroup" --name "yourVM"
    

Instructions:

  1. Install Azure CLI: If not installed, follow the instructions at Install Azure CLI.
  2. Log in: Run az login in your terminal and sign in.
  3. Replace yourResourceGroup, yourVM, and yourDisk with your values, found in the Azure Portal.
  4. Run the commands in a terminal or Azure Cloud Shell (Bash).

Pros: Works on Linux, macOS, and Windows; ideal for automation.
Cons: Requires Azure CLI installation if not using Cloud Shell.

Tips and Warnings

  • Test first: Try the migration on a non-critical VM to ensure the process works.
  • Verify disk name: Find the disk name in the Azure Portal under the VM’s "Disks" section.
  • Backup: Although migration doesn’t cause data loss, create a snapshot as a precaution before starting.
  • Costs: Compare Standard SSD and Premium SSD costs on Azure’s pricing page before choosing.
  • VM size compatibility: Most VM sizes support Standard SSD, but if switching to Premium SSD, ensure the VM size supports it (e.g., DS-series).
  • Multiple VMs script: The script in Method 3 assumes all VMs in the resource group use managed disks. If any use unmanaged disks, convert them first (see Microsoft’s documentation).

Why This Guide’s Scripts?

The PowerShell scripts are streamlined for OS-disk migration to Standard SSD, focusing on simplicity while being robust. The multiple VMs script (Method 3) loops through all VMs in a resource group, checks disk types to avoid redundant updates, and includes logging for clarity. Compared to Microsoft’s scripts, these are shorter as they omit complex cases like VM size changes (unnecessary for Standard SSD) and Premium SSD v2/Ultra Disk migrations (not applicable for OS-disks).

Next Steps

Kommentarer

Populära inlägg i den här bloggen

Boost Your Graphics Power med GPU-acceleration i Azure Virtual Desktop!

🚀 IntuneWin – Deploying Win32 Apps via Intune 🎯

Block Personal devices to acces to Desktop apps like teams, Onedrive etc and how to troubleshooting the issue.