Cloning and running Azure VM with the same Internal IP address without impacting the existing Production VM?

EnterpriseArchitect 5,036 Reputation points
2020-10-12T02:13:00.71+00:00

Hi All,

I need to know what's the steps that I need to follow successfully to clone the Azure VM into separate Subscription with the same IP address (Private IP only)

From:
Subscription: CORP-PROD-AZ-CC
Resource Group: CORP-PROD-ERP-RG
VM Name: PROD-ERP01-VM
IP:10.17.1.10

Into:
Subscription: CORP-TEST-AZ-CC
Resource Group: CORP-TEST-ERP-RG
VM Name: TEST-ERP01-VM
IP:10.17.1.10

As you can see the above, the VM is using VNet with the Internal IP assigned 10.17.1.10
How to clone it successfully to different Subscription, and then retain the same IP address, and start it up without impacting the Production VM?

I assume the VM in different Subscription and Resource group, can have the same IP internal address and can be tested with the Network disconnected to avoid IP address conflict?

The server PROD-ERP01-VM [10.17.1.10] is currently accessed by multiple OnPremise servers via Express Route.

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,479 questions
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,267 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. vipullag-MSFT 25,616 Reputation points
    2020-10-12T07:02:47.987+00:00

    @EnterpriseArchitect

    I just tried this in my lab and below are the steps to achieve your ask:

    Assumption based on your ask: In your Sub: CORP-TEST-AZ-CC & RG: CORP-TEST-ERP-RG you have already configured the VNET and subnets similar to Prod.
    You can clone the VM by creating Snapshot of the disks and moving the snapshots to the new Sub and creating disk and then VM using the OS disk.

    1. Create snapshot of the Disk
      • Sign in to the Azure portal.
      • Go to the Virtual Machine (PROD-ERP01-VM).
      • Select Disks from the settings.
      • In the Disk, page select OS disk.
      • Select Create snapshot.
      • The Create Snapshot window appears.
      • Enter a Name for the snapshot.
      • Select an existing Resource group or enter the name of a new one.
      • Select the Storage type to use to store the snapshot.
      • Select Create.
    2. Move Snapshot to test Subscription
      • Go to the RG where the Snapshot is created.
      • Select the snapshot and click on Move (move to CORP-TEST-AZ-CC Sub).
    3. Create disk from Snapshot
      • In your test Sub, search for Disk on the Search.
      • Select Add
      • Select the Resource Group and Region where the Snapshot is located.
      • Give a name to the Disk.
      • In the Source type Select Snapshot.
      • Choose the Snapshot (Moved in Step 2).
      • Select Create.
    4. Create VM from Disk

    If you want to create a VM with static private IP address, you must create it using PowerShell or the Azure CLI (refer document).
    Ensure you set the CLI to the test subscription using az account set --subscription "CORP-TEST-AZ-CC" command (refer document).

    You can use below command and create the VM from the disk (refer cli document):

    az vm create -n TEST-ERP01-VM -g CORP-TEST-ERP-RG --attach-os-disk <disk-name> --os-type <os> --private-ip-address "10.17.1.10"  
    

    If your VM has data disks also, then you need to perform the snapshot and copy snapshot for all of the VM disks.
    After creating all the disks in test subscription, then you have to include the --attach-data-disks argument.

    Please 'Accept as answer' if the provided information is helpful, so that it can help others in the community looking for help on similar topics.

    1 person found this answer helpful.
    0 comments No comments

  2. EnterpriseArchitect 5,036 Reputation points
    2020-10-12T07:42:45.547+00:00

    @vipullag-MSFT

    Many thanks for the quick reply, so in this case, do I need to disconnect the vNIC on the cloned VM to avoid production IP conflict ?

    Or this is not a problem since the different VNET can be created with the same subnet range in another RG and Subscription.