I have recently encountered a couple of situations where it has been necessary to resize disks attached to Azure virtual machines. Generally it has been on machines that have previously been migrated to Azure from their original on-premises infrastructure where storage was more of a premium.
When deploying machines directly in Azure its generally felt that deploying the largest disk possible is the best option. This is because regardless of the disk size, charge is only made for the actual amount of data written to the disk and not the size of the disk itself. The exception to the rule is when using premium storage which is the reverse and charged on the size of the disk and not the amount of data written in it.
In this example the operating system disk is nearly full and needs to be increased in size.
The first thing that must be done is to work out the disk name of the disk that needs to be resized. This can be done in various ways but generally its easiest to use either the Azure Portal or PowerShell.
Open the Azure portal then select Virtual Machines > Machine Name > All Settings > Disks and locate the disk name.
As mentioned its also possible to use PowerShell to pull back a list of all disks deployed in the current subscription from which their names and other attributes can be gathered. The first step is to connect to Azure and check that we are connected to the correct subscription.
To select an alternative subscription use the following PowerShell command.
Select AzureSubscription -SubscriptionID "Subscription ID"
Now connected to the subscription we require, its possible to search for a list of disks and the virtual machines that they are associated with.
Get-AzureDisk | fl Label, AttachedTo, DiskName
Update-AzureDisk -DiskName <diskname> –ResizedSizeInGB <size in GB> –label <labelname>
Update-AzureDisk -DiskName TechKB-SVR01-TechKB-SVR01-0-201601281807180110 –ResizedSizeInGB 500 –label sysDrive
From within the guest open Disk Manager > Right Click System Volume > Expand Volume and follow the wizard through to add the extra space to the system volume.