How to upgrade an azure VM? I have a VM in azure. As I was looking at the bill I realized it is not an RI - Reserved instance. With a reserved instance prices can be half to a third. So I wanted to convert this VM to a 3 year reserved instance. By their cost calculator that will come to about 300 dollars for 3 years.

However when I tried to upgrade the VM (They call it resize), I have realized this is an older VM and I am not able to reserve it for 3 years. So this article goes into how to find a suitable VM that can be reserved for 3 years and how do I migrate my OS disk and the data to this new VM

In addition the VHD (hard disk) I had seemed to be a nonmanaged disk. I needed to convert that to a managed disk as well. this article will go into that as well with some useful reads from microsoft azure site.

How to upgrade an azure VM?

Search for: How to upgrade an azure VM?

I go to the reservations blade but I don't see the VM type: Basic A1 (1 vcpus, 1.75 GiB memory).

Looks like this is an expired VM and needs to be upgraded

Upgrading a VM seem to be known as "resizing" the VM while the virtual machine blade (panel) is open.

However the VMs shown don't match the VMs that are in the "reservation" bucket.

So I submit a case

I was advised to look at the pricing calculator (which is a nice feature) and I pick a VM. Not all VMs have the 3year option. I managed to find one. I send that to the case folks and see what happens.

My question now is, how do I change my old VM to the new VM while I keep my previous hard drive intact so I don't have to install new software.

And the previous disk says it is an "unmanaged", not sure what that means either.

Perhaps if the VM that is listed as "reservble" had been located in the "size" panel i suppose it would have been easier.

Not sure yet how to use this one and for what. I am able to browse through storage account and see a few "VHD" instances under Blob containers. That makes me wonder the structure of a storage account.

What is an azure VHD?

Search for: What is an azure VHD?

What is an azure VHD Snapshot?

Search for: What is an azure VHD Snapshot?

So it is not a hard drive by itself. wonder how the hard drive is then associated with the VM???

How to create a snapshot

Managed disks are documented here

In azure, How to attache a managed disk as OS disk to the virtual machine

Search for: In azure, How to attache a managed disk as OS disk to the virtual machine

Open the storage explorer
Go to blob containers
Locate the VHD
See the tabular properties of that VHD
There is a column called "Disk Type"
This column shows "OSDisk"

what is a leased VHD in azure?

Search for: what is a leased VHD in azure?

There is a lot of information on storage accounts and VHDs at this blog

The word "leased" next to a VHD means it is being used by another service such as a VM

The column VM Name for that VHD will indicate the name of the VM that is using the disk

The column "Disk Type" shows whether it is an OS disk or a data disk

There seem to be some differences between managed and unmanaged disks.

An Azure managed disk is a virtual hard disk (VHD).

Azure managed disks are stored as page blobs, which are a random IO storage object in Azure.

A managed disk is ?managed? because it is an abstraction over page blobs, blob containers, and Azure storage accounts.

Data disk: A data disk is a managed disk that's attached to a virtual machine to store application data, or other data you need to keep. Data disks are registered as SCSI drives and are labeled with a letter that you choose.

The size of the virtual machine determines how many data disks you can attach to it and the type of storage you can use to host the disks.

OS Disk: Every virtual machine has one attached operating system disk. That OS disk has a pre-installed OS, which was selected when the VM was created.

Temporary disk: Every VM contains a temporary disk, which is not a managed disk. The temporary disk provides short-term storage for applications and processes and is intended to only store data such as page or swap files. Data on the temporary disk may be lost during a maintenance event event or when you redeploy a VM. On Azure Linux VMs, the temporary disk is /dev/sdb by default and on Windows VMs the temporary disk is D: by default. During a successful standard reboot of the VM, the data on the temporary disk will persist.

A snapshot is a copy of a disk at the point in time the snapshot is taken. It applies only to one disk. If you have a VM that has one disk (the OS disk), you can take a snapshot or an image of it and create a VM from either the snapshot or the image.

1. Use Reservation service to look for a VM that is eligible for 3 years and has the right size. You need this info because when you try to resize the VM through the Portal you need to recognize this particular VM. (Not all VMs may be available in the options list)

2. Stop the current VM. This is because the available VMs to resize to seem to differ when it is running and when it is not running!! Don't know why. but so is the case. So stop the VM

3. Now locate the VM that you saw in reservations in the available VM list. If you don't see it, you cannot use this option. If you do see it, pick it up and resize the VM through the portal.

4. This may take 10 minutes for the network ips to reset etc. On my previous VM my ip is a static IP. If it were not a static IP I am not sure how you go about doing it. I mean you will get the new VM but it will have a different public IP if the original ip was not a static ip. If the original ip was a static ip, it seem to keep it.

5. This process also seem to add a number of things into that resource group. I haven't paid attention as to what the new entries are!

You can click "+add" to look or add a new reservation, be it a VM or SQL Server etc. Not every service is available.

Notice the availale scope options for the reservation to apply. In my case my VM is in a resource group. I do not know how to apply this reservation against "one VM" that I want to buy for 3 years. This is the closest scope I could get to. Hopefully the reservation will look for a matching VM size and apply the billing correctly.

Notice the selected resource group. Also notice the filter "b" to get to the VMs named basic "standard_b*". Choose the right region and the term of 1 year or 3 years. Now when you choose that row, it will calculate the price for the term at the bottom. On the next page it will allow you to buy the number of units. Hopefully this number of units will let you decide how many of the VMs in that resource group are billed with that 3 year frequency. It is a puzzle however as to what if there are many VMs with that spec in that resource group?

1. Go to portal

2. Locate the VM

3. Go to disks

4. Choose migrate to "managed disks"

5. This will stop, migrate the disks, and restarts the VM. It will apparently leave the original unmanaged VHD intact (for you to keep or delete afterwards)

6. Official documentation suggests to do this only in a test mode and then eventual swap it into production. In my case I just took a chance. Seem to work

7. However I have not investigated what changes were also made to the resource group after this operation.

8. This will take sometime based on the disk size

Read this microsoft doc on converting a VM to use managed disks

Previously this disk is inside the "storage account".