No, you can only set Spot pricing flag during the creation time. As of today you cannot convert the VM to Spot VM.
Convert existing VM to azure-spot

I cannot find in the documentation a mention of converting an existing VM to an azure-spot instance.
Nor can I see a way in the portal to do so, although all the relevant azure-spot information fields are showing for the VM - they just show it isn't a spot!
Can a VM be converted?
4 answers
Sort by: Most helpful
-
-
Larry Claman 16 Reputation points
2020-04-07T13:34:31.497+00:00 Seems like you could re-create the VM using the same technique as you would to move a VM into an availability set. (eg https://learn.microsoft.com/en-us/azure/virtual-machines/windows/change-availability-set)
I'll see if I can prototype this & will post back when I have it workingEdit: got this working. see https://gist.github.com/larryclaman/5a3bb2a7b0bb7b559b1af192469c718a
-
Ed Morris 36 Reputation points
2020-06-01T11:01:52.943+00:00 You can also achieve the same through the web portal.
The steps are:
- Power down your VM from the VM summary page and wait for it to deallocate.
- Go DISK page of the VM, select the link for the OS disk to look at its Overview.
- On the overview page, click the create snapshot button to create an image of the current OS disk.
- Give it a name, and make the snapshot type full, selecting also Zone-redundant.
- Create the snapshot, taking note of its size.
- Navigate to the disk page from the Azure portal homepage, and in the top left of the menu bar select the add button.
- Create the disk as you would like, making sure the disk size is at least the size of the snapshot (it can be larger if you like). Select the source type as snapshot and select the name of the snapshot you just created.
- Create the disk.
- Navigate back to the Disks list page on the portal, and click into the new disk just created to view the overview page.
- On the new disks overview page, select Create VM from the horizontal menu bar, which will start a VM creation page, with the current disk as the OS disk.
- Be sure to select the Azure Spot Instance radio button to yes to make this a spot instance.
- All other options are the same as using an on-demand instance.
-
Derek Da Silva 1 Reputation point
2020-05-04T20:43:14.407+00:00 Larry- thanks for your script. I was able to use it to convert from spot to regular VM. Great job!
D