Convert an Azure Managed Disk to Standard SSD with Azure CLI
Microsoft recently announced a new "standard SSD" option for managed disks. These offer the improved performance of SSDs but at a reduced cost compared to Premium SSDs.
For example, I have a development VM which I only run occasionally, so most of the time it's in a Stopped Deallocated state, not costing me anything.
But managed disks must be paid for whether they're currently in use or not. A standard HDD of 128GB isn't too pricy at £4.39 a month, but it's four times more to have a Premium disk, and if I were to need to go up to the next size I'd be paying £32 a month for a disk I might not be using at all.
Tier | 128GiB | 256GiB | 10K transactions |
---|---|---|---|
Premium | £16.16 | £31.17 | £0 |
Standard SSD | £4.35 | £8.38 | £0.000746 |
Standard HDD | £4.39 | £8.45 | £0.000373 |
The new Standard SSD pricing tier is priced similarly to the Standard HDD, only you pay more per 10K transactions (transactions are free on the premium tier).
My development VM was using Standard HDD and was very sluggish, so I wanted to give Standard SSD a try, but unfortunately you can't select Standard SSD in the Azure Portal at the moment.
However, it is possible (while the VM is not running) to change the managed disk type using the Azure CLI.
Assuming you've logged in with az login
and selected the correct subscription, you just need to know the resource group name and the disk name.
In my case the disk name had been auto-generated so I got hold of it with
$diskName=az disk list -g $resGroupName --query [0].name -o tsv
And then the command to change to Standard SSD, just involves setting a new sku
:
az disk update -g $resGroupName -n $diskName --sku StandardSSD_LRS
And that's it. It converted me to a 127GB Standard SSD (not sure where the extra GB went!), and first impressions are that it is more responsive than before. There's also a --size-gb
switch for az disk update
which I haven't tried yet, but should allow increasing the disk size if necessary.