Swapping OS disks
Swapping OS disks is a simple operation that can be performed without stopping or deallocating a virtual machine. The decision of whether to stop a machine or perform a swap without downtime relies on the type of workload you have running on a machine. It’s not guaranteed that swapping operations won’t interfere with your services, so to be on the safe side, it’s recommended to plan downtime upfront. No matter whether you go for downtime or not, the operation will be performed in the same way.
The only command you need to swap OS disks is the command for updating a virtual machine’s properties:
az vm update \ -g <resource-group-name> \ -n <vm-name> \ --os-disk <os-disk-resource-id>
The only difficulty in performing that operation is making sure that the virtual machine and disk are compatible. Remember that not all virtual machines support Premium disks. If...