Hello MIU_Admin
I am not entirely sure if you are trying to increase or decrease the disk size, based on your question. Full details of changing the disk size can be found here https://learn.microsoft.com/en-us/azure/virtual-machines/windows/expand-os-disk
Increasing the disk size can be done without deallocating your virtual machine. Deallocating , a machine takes the virtual machine offline and deprovisions the underlying hardware. This can be achieved by pressing the stop button on the toolbar for that virtual machine.
If you are wanting to resize the disk while the VM is running, there are the following limitations
- Only supported for data disks (Not OS Disk).
- If a disk is 4 TiB or less, you should deallocate your VM and detach the disk before expanding it beyond 4 TiB. If a disk is already greater than 4 TiB, you can expand it without deallocating the VM and detaching the disk.
- Not supported for Ultra disks or Premium SSD v2 disks.
- Not supported for shared disks.
- Install and use either:
- The latest Azure CLI
- The latest Azure PowerShell module
- The Azure portal
- Or an Azure Resource Manager template with an API version that's
2021-04-01
or newer.
- Not available on some classic VMs. Use this script to get a list of classic VM SKUs that support expanding without downtime.
If your disk do not meet these requirements, then you will need to deallocate your virtual machine before following the steps on the page provided. You will not lose data for increasing disk size.
Decreasing the size of a disk can be done, though this isn't supported and may result in data loss. Ensure you have appropriate backups before attempting this and only if absolutely necessary.
I hope this clarifies things
Alistair