DEV Community

Cover image for How to Create and Configure Virtual Network in Azure

How to Create and Configure Virtual Network in Azure

What is a Virtual Network?

A Virtual Network (VNet) in Azure is a logically isolated network that provides secure communication between resources like virtual machines, databases, and other services in the cloud. It allows you to define IP address ranges, subnets, and network configurations, enabling private communication within the VNet or with on-premises networks through VPN or ExpressRoute. VNets are essential for organizing, securing, and connecting resources in Azure.

Azure Virtual Network Peering and subnets are essential for building secure, connected, and scalable cloud environments. Virtual Network Peering enables seamless communication between Azure virtual networks, while subnets allow you to segment and organize your network for better management and security.

In this guide, we’ll walk you through the steps to create and configure both, ensuring your Azure networking setup is optimized for your workloads.

Tasks

  1. Create virtual networks.
  2. Create subnets.
  3. Configure virtual network peering.

Architecture diagram

Architecture diagram


Steps:

Create hub and spoke virtual networks and subnets

  • Sign in to the Azure portal.

  • Search for and select Virtual Networks.
    Virtual Networks

  • Select + Create.
    + Create

  • Assign to a Resource group RG11.

  • Set the name as app-vnet.

  • Region to East US.
    configuration

  • The IPv4 address space is 10.1.0.0/16

  • This virtual network requires two subnets, frontend and backend.

  • Set the Subnet address range of the frontend subnet to 10.1.0.0/24.

  • Click Add to save.
    frontend subnet

  • Select Add a subnet for the backend subnet.

  • Set the Subnet address range to 10.1.1.0/24

  • Click Add to save.
    Note:Leave all other settings as their defaults. When finished, select Review + create and then Create.
    backend subnet

+ create

Create the Hub-vnet virtual network configuration. This virtual network has the firewall subnet.

  • Search for and select Virtual Networks again.
  • Select + Create.
  • Assign to the same Resource group as app-vnet RG11.
  • Set the Name as hub-vnet.
  • Region to East US as well.
  • Click Next to the IP addresses section.

Hub-vnet virtual network

  • The IPv4 address space is 10.0.0.0/16
  • Select Add a subnet.
  • Name the subnet AzureFirewallSubnet.
  • Set the Subnet address range to 10.0.0.0/26
  • Click Add to save.
  • Select Review + create and then Create.

firewall subnet

Create

Configure a peer relationship between the virtual networks

  • Search for and select the app-vnet virtual network.

  • In the Settings blade, select Peerings.

  • + Add a peering between the two virtual networks.

Peerings

  • Set the Remote peering link name to app-vnet-to-hub.
  • The Virtual network peered to hub-vnet.

Remote peering link name

  • Set the local virtual network peering link name to hub-to-app-vnet.
  • Leave all other settings as their defaults.
  • Select *Add to create the virtual network peering.

Create the virtual network peering

  • Once the deployment completes, verify the Peering status is Connected.

Peering status

Conclusion

With this step-by-step guide, you have now successfully created virtual networks, subnets, and peer two virtual networks, which helps to manage the Vnet better and secure communication between networks and their resources.


Thank you for reading my blog.😊😊

If you need further assistance, feel free to reach out in the comment or hit me up on Twitter. You can also follow me on GitHub. My DM's are open and love discussions on cloud topics!😁

: Oluwatofunmi Emmanuel Oluwaloseyi

Top comments (0)