Expanding the OS drive of a Virtual Machine in an Azure

Posted: October 10, 2017 in Azure

I created B1MS standard (cheapest one 🙂 )

Capture.PNG

With 126 GB of C partition

1.png

$vm=Get-AzureRmVM -ResourceGroupName example -name win2016
#stop VM
Stop-AzureRmVM -Name win2016 -ResourceGroupName example -Force
#extend disk to 2TB
$vm.StorageProfile.OsDisk.DiskSizeGB=2048
Update-AzureRmVM -ResourceGroupName example -vm $vm
#start VM
Start-AzureRmVM -ResourceGroupName example -name win2016

We now need to expand partition

2.PNG

$MaxSize = (Get-PartitionSupportedSize -DriveLetter c).sizeMax
Resize-Partition -DriveLetter c -Size $MaxSize

3.PNG

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s