DEV Community

Cover image for How to Create and Configure Virtual Networks in Azure
Oluwanifesimi
Oluwanifesimi

Posted on

How to Create and Configure Virtual Networks in Azure

Introduction
Azure Virtual Network (VNet) provides a secure and scalable environment for Azure resources to communicate—whether it's with each other, external networks, or on-premises infrastructure. Within a VNet, resources are organized into subnets, allowing for structured and efficient network segmentation.

In this project, you'll gain hands-on experience with key networking tasks, including:

  • *Creating a Resource Group *– The foundational container for managing related Azure resources.
  • Setting Up a Virtual Network and Subnets – Establishing the core network structure to host your services.
  • Configuring a Secondary VNet with a Firewall Subnet – Enhancing security through network isolation and traffic control.
  • Establishing VNet Peering – Enabling seamless communication between two virtual networks.

By the end, you'll have a solid grasp of how to architect secure and interconnected environments in Azure.

Step 1: Create a Resource Group

  • Sign in to the Azure Portal
    login

  • In the search bar, search for Resource groups
    search bar

  • Select + Create.
    create

  • Enter the following properties:
    Property Value
    Resource group RG1
    Region East US

  • Click Review + create and then Create.
    REIEW CREATE

  • Then Create.
    CREATE rg

Step 2 Create hub and spoke virtual networks and subnets

An Azure virtual network enables many types of Azure resources to securely communicate with each other, the internet, and on-premises networks. All Azure resources in a virtual network are deployed into subnets within the virtual network.

  • In the Azure portal, Search for and select Virtual Networks.
    Virtual Networks

  • Create and complete the configuration of the app-vnet. This virtual network requires two subnets, frontend and backend.
    Im app-

  • Select + Create
    create

  • In the Basics tab, enter the following information:

  • Select “Review + create"
    Property Value
    Subscription Select your subscription
    Resource group RG1
    Name app-vnet
    Region East US
    region

  • Then Create.
    create

  • Click on go to resources button
    resource button

Step 3: Configure IP Address Space

  • Under settings, Select Address Space
  • In the IP Addresses tab, set the following:
  • IPv4 address space: 10.1.0.0/16 and Click on save button. This address space will allow multiple subnets within the virtual network.

Ip addresses

Step 4: Create Subnets

  • Still in the IP Addresses tab, add two subnets:
  • Subnet name Address range
  • frontend 10.1.0.0/24
  • backend 10.1.1.0/24
  • Leave other settings as defaults.

For Frontend subnet

  • Under settings, Select Subnet
  • Select + Subnet
  • Give subnet a name frontend, enter starting address 10.1.0.0, enter size /24 and Click on Add.

frontend

For backend subnet

  • Under settings, Select Subnet
  • Select + Subnet
  • Give subnet a name backend, enter starting address 10.1.1.0, enter size /24 and Click on Add.
    backend

  • Frontend and the Backend Subnet as been created successfully
    frontend/backend

Step 5: Create the Hub-VNet Virtual Network

  • Create another virtual network called hub-vnet.
  • In the Azure portal, Search for and select Virtual Networks.
    Nets

  • Select + Create
    create

  • Enter the following properties:

  • Property Value

  • Resource group RG1

  • Virtual network name hub-vnet

  • Region East US

  • Select Review + create

hub

  • Then Create.
    creeeate

  • Click on go to resources button
    resources button

Step 6 Configure IP Address Space for the firewall subnet

  • Under settings, Select Address Space
  • In the IP Addresses tab, set the following:
  • IPv4 address space: 10.0.0.0/16 and Click on save button. This address space will allow multiple subnets within the virtual network. configure

Step 7 Create firewall subnet

  • Under settings, Select Subnet
  • Select + Subnet
  • Select subnet purpose azure, enter starting address 10.0.0.0, enter size /26 and Click on Add.
    subset azure

  • The Firewall subnet as been created successfully
    firewall subnet

Step 8 Configure a peer relationship between the virtual networks

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

  • In the Settings blade, select Peerings.

    • Add a peering between the two virtual networks. peering
  • Complete the following Configurations.

  • Remote peering link name: app-vnet-to-hub

  • Virtual network: hub-vnet
    hub

  • Local virtual network peering link name: hub-to-app-vnet

  • Note: Leave all other settings as their defaults. Select “Add” to create the virtual network peering.
    hub-net

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

Conclusion
By completing this project, you've built a solid foundation in cloud networking—gaining practical skills in designing and configuring Azure Virtual Networks. From creating VNets and organizing them into subnets to enabling seamless communication through VNet peering, you've tackled essential components of cloud infrastructure. These capabilities not only strengthen your technical proficiency but also pave the way for more advanced scenarios, such as implementing network security groups, deploying VPN gateways, and integrating hybrid connectivity solutions. Mastering virtual networking is a key milestone on the path to becoming a confident and capable cloud architect.

Top comments (0)