2 Different VMS are in different virtual network

sns 9,226 Reputation points
2022-08-13T05:01:57.617+00:00

2 Different VMS are in different virtual network, These Virtual are networks got created in the backend when I created the VM
I want to bring these 2 vms in to one network. Please suggest how to achieve this.

VM1 - IP is - 10.3.0.4
VM2 - IP is - 10.4.0.4

I want to bring VM2 in to VM1 IP network. Please suggest

Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
2,180 questions
0 comments No comments
{count} votes

Accepted answer
  1. Andreas Baumgarten 97,566 Reputation points MVP
    2022-08-13T10:25:58.377+00:00

    Hi @sns ,

    follow these steps to create a VM based on an existing managed disk:

    • Navigate to Disks in the Azure Portal
    • Find the OS Disk of the deleted VM (enter the name of the VM in the filter)

    230833-image.png

    The Owner property of the disk should be -

    • Click on the disk
    • Select Create VM

    230858-image.png

    • Follow the Create a virtual machine wizard and select the Virtual Network and Subnet you want the VM connected to.

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten


7 additional answers

Sort by: Most helpful
  1. Dillon Silzer 54,731 Reputation points
    2022-08-13T05:31:41.957+00:00

    Hey @sns

    From another similiar post (answered by AndreasBaumgarten)

    It's not possible to switch a VM between subnets/vnets without deallocating/deleting-recreating.

    Easiest way:

    -Delete the VM but keep the OS Disk.
    -Deploy a new VM in the new subnet and use the still existing OS Disk.

    Cited from https://learn.microsoft.com/en-us/answers/questions/130410/how-to-change-the-vnet-of-a-vm.html

    ---------------------------------

    If this is helpful please accept answer.

    0 comments No comments

  2. Andreas Baumgarten 97,566 Reputation points MVP
    2022-08-13T07:09:14.937+00:00

    Hi @sns ,

    because sometimes the wording of virtual network, vNet and Subnet is mixed:

    A Virtual Network (vNet) contains 1 or more Subnets
    A Virtual Machine (VM) is connected at least with 1 Subnet in 1 Virtual Network (the VM is not directly connected with a Virtual Network. Instead the VM is connected with a Subnet of a Virtual Network)

    For instance:
    Azure Virtual Network: 10.2.0.0/16 address space

    230847-image.png

    Same Virtual Network with 2 Subnets
    Within the same Virtual Network with 2 Subnets the VM can be connected to a different subnet without deleting/recreating. The "delete and recreate approach" isn't necessary )

    230932-image.png

    Different Virtual Network
    If you want to connect the VM with a Subnet in a different Virtual Network you have to follow these steps:
    -Delete the VM but keep the OS Disk.
    -Deploy a new VM in the new subnet and use the still existing OS Disk.

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten


  3. Andreas Baumgarten 97,566 Reputation points MVP
    2022-08-13T08:33:13.197+00:00

    Hi @sns ,

    yes, just delete the Network Interface and the Public IP. Keep the OS Disk.

    During the deployment of the new VM select the Virtual Network and the Subnet on the Networking tab you want to connect the VM to.

    230832-image.png

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten


  4. Andreas Baumgarten 97,566 Reputation points MVP
    2022-08-13T11:05:27.957+00:00

    Hi @sns ,,

    please try to ping VMONE from VMTWO.
    please try to ping the domain name snstelangana.com from VMTWO
    In both cases you should get a positiv result.

    Verify the DNS settings of the "old" subnet/Vnet and the "other subnet/Vnet"
    Are both VMs in the same Subnet in the same vNet?

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten