Azure portal

Create vnet1

  • Create a vnet called vnet1
  • Leave the address space at 10.0.0.0/16
  • Create a subnet in that vnet called vnet1-subnet
  • Give the

Create vnet2

  • Create a vnet called vnet2
  • Change the address space to 10.1.0.0/16
  • Create a subnet in that vnet called vnet2-subnet

Create a peering for vnet1 & vnet2

  • Virtual networks => vnet1 => Peerings => Add
  • Name: vnet1-vnet2
  • Virtual network: vnet2
  • Peering name: vnet1-vnet2

Create vm1

  • Place in vnet1 with default vnet subnet

Create vm2

  • Place in vnet2 with default vnet subnet

Test

  • test by pinging the private IP of each vn
  • remove the peering and test ping again

Terraform

Bicep