In this article, we are going to learn how to change the Subnet of a given Virtual Machine.
While working on setting up the Azure Application Gateway, I had to create three virtual machines in a single Subnet. However, by mistake, I created an Azure Virtual Machine in an incorrect Subnet. Instead of creating the Virtual Machine vm1 in the web-snet subnet, I created it in the other subnet named gateway-snet as shown below.

Now, I have to move the Virtual Machine from web-snet subnet to gateway-snet. Let’s learn how to do it.
Before, we move further, we first need to understand how a Virtual Machine is integrated with a subnet. To be more specific Virtual Machines are not directly connected with a Subnet. Virtual Machines are connected with Network Interface Card and in turn those NICs are connected to the Subnets. So, technically speaking, it is not possible to change the Subnet of a Virtual Machine as they are really not connected with the Subnet.
So, in order to change the Subnet associated with a Network Interface Card, navigate to the NIC to which the Virtual Machine is connect by clicking on the NIC associated with the Virtual Machine as shown below.

As shown in the steps of the above diagram
- Click on the Virtual Machine for which you would like to change the Subnet
- Click on the Networking blade
- Click on the Network Interface Card
You will be taken to the Network Interface’s Overview blade. Follow through the below indicators now.

- Click on the IP configurations blade
- Click the dropdown associated with the Subnet label
- The dropdown shows all the available Subnets. Choose the subnet to which you would like to associate the Network Interface Card.
As soon as you change the subnet, you will see the warning message “The virtual machine associated with this network interface will be restarted to utilize the new subnet” as shown below.

If you are sure about the change and are okay with the restart of the associated Virtual Machine of the Network Interface Card then click on Save button as shown in the above screenshot.
That’s it, the Virtual Machine will be restarted and then you can view the updated Network Topology as shown below.

Do you like this article? If you want to get more updates about these kind of articles, you can join my Learning Groups
very informative blog, it was well explained about azure and its topics, it was worth time investing reading this article. I hope more articles about azure in future.
LikeLike
very good article, it was clearly explained all the topics, it was really worth reading this blog.
LikeLike
This is good article, thank you! I did the same mistake I added the machine to the default subnet and forgot to change it when I created the VM.
LikeLike