Several Azure Virtual machine tiers offer to compute resources depending on the needs that arise in resources, for example, General purpose, Compute-optimized, Memory-optimized, GPU, Storage Optimized and High-performance computing. Sometimes the cost could be prohibitive, and the calculations begin. In most cases the cost could be skyrocket because of the storage type, e.g. a Premium SSD is far more expensive than an HDD or Standard SSD.
In that post, I will show you the steps to convert storage from Standard HDD to a Premium SSD with two way first via the Azure Portal and next using Azure PowerShell. The same steps apply when converting Standard HDD to Standard SSD etc.
|Important: Make sure the Azure Virtual Machine size support Premium Storage.|
The case is quite simple, we have an Azure Virtual machine first deployed with Standard HDD disks, but the performance for some applications is very disappointing. After that, the Azure Administrator start monitoring the VM resources and concludes that the issue is on the storage. Below I will saw to you how to upgrade the storage tier.
Convert Standard HDD to Premium SSD (Portal)
To begin with, shutdown the VM, and then follow the steps below.
After the VM is stopped, select Settings – Disks
select the disk which needs to change the tier, and then select Size + performance and choose the desired “Disk SKU”
Convert Standard HDD to Premium SSD (PowerShell)
The script below show how to convert a Standard HDD to a Premium SSD.
|# Connect to Azure Account|
Connect-AzAccount# Set the subscription context
Set-AzContext -SubscriptionId “a3c3e263-f1bc-42ad-ae5b-8860641336c8″## VARIABLES ### Resource Group Name
$RGName = ‘Disk_Test’# Azure Virtual Machine Name
$VMName = ‘disktest’# Select between 1.Premium_LRS 2.StandardSSD_LRS 3. Standard_LRS 4. UltraSSD_LRS$StorageType = ‘Premium_LRS’
$VM = Get-AzVM -Name $VMName -resourceGroupName $RGName
# Get all disks in the resource group of the VM
# The selected VM Disks will be converted to the desired storage type