Skip to content

TechDirectArchive

Hands-on IT, Cloud, Security, Veeam & DevOps

  • Home
  • About
  • Advertise With US
  • Reviews
  • Contact
  • Toggle search form

Azure Virtual Networks: Preparing Azure and On-Premises Virtual Networks with Azure CLI Commands

Posted on 09/11/202127/08/2026 Imoh Etuk By Imoh Etuk No Comments on Azure Virtual Networks: Preparing Azure and On-Premises Virtual Networks with Azure CLI Commands
  1. Home
  2. AWS/Azure/OpenShift
  3. Azure Virtual Networks: Preparing Azure and On-Premises Virtual Networks with Azure CLI Commands
Slide1-3

If you just heard of the term “Azure Virtual Network (Azure VNet)”, it might sound strange to you particularly if you’re not coming from the background of Microsoft Azure Cloud but trust me, it will no longer be strange to you after reading this post and practicing along with your computer. Pleaae see how to create, edit, save a file and quit Vim Editor in Linux, Locate, Find, and Grep: How to search for files and patterns in Linux/Unix-like OS and How to Save Read-Only Files in VIM Editor in Linux/Unix-like OS

Getting started with Azure Virtual Network is easy just the same way you would purchase networking equipment such as switches, routers, access points, and repeaters to build a network station to enable you to establish connections between your office or home computers in order for them to interact, communicate and share data with each other, is the same way you also need to set up Azure Virtual Network in a few clicks or issuing of few commands to enable the Virtual Machines hosted on Azure to communicate and exchange information with each other.

Before I proceed, I will like to point you to some of my previous posts on how to fix “Failed to open session in VirtualBox to install Windows 11 Image”. If you’re a Linux user, you can check out most of my last post on A brief Introduction to Linux and how to create disk partition in Ubuntu Linux.

Before I proceed, I will like to point you to some of my previous posts on how to fix “Failed to open session in VirtualBox to install Windows 11 Image”.

If you’re a Linux user, you can check out most of my last post on A brief Introduction to Linux and how to create disk partition in Ubuntu Linux, how to create, edit, save a file and quit Vim Editor in Linux, “how to Locate, Find, and Grep: How to search for files and patterns in Linux/Unix-like OS”, and how to Save Read-Only Files in VIM Editor in Linux/Unix-like OS

What is Azure Virtual Network?

The simple difference is you’re responsible for purchasing and managing all aspects of your on-premises network while Azure is responsible for providing you with the infrastructure you need to create and set up your Virtual Network on Azure.

So, Azure Virtual Network is classified as one of the components of an Infrastructure as a Service (IaaS) cloud model. You can learn more about PaaS and SaaS. Below is the brief meaning of Azure Virtual Network according to Microsoft:

So, an Azure Virtual Network (VNet) is a representation of your own network in the cloud. It is a logical isolation of the Azure cloud dedicated to your subscription.

Looking to get started with Container solutions like Docker and Kubernetes, Azure, PowerShell, and Azure DevOps?

Virtual Network Preparation

Back to the business of the day, to be able to set up a network connection between Azure and on-premises virtual networks, you need to, first of all, prepare the Virtual Network on Azure.

In this post, you will learn how to prepare Azure and on-premises virtual networks using Azure CLI commands. After setting up this, you will then be able to start to securely establish connections between your on-premises servers and the resources hosted in Azure across your organization.

Prerequisites to Preparing Azure Virtual Network

To follow along, you need:

  • an Azure account with an active subscription. Create one for free.
  • to sign into Azure Portal
  • to click on the Azure Cloud Shell icon at the right side of the portal screen as shown in the diagram below:
Azure Virtual Networks-Launch-the-Cloud-Shell
Azure Portal

We will start by creating the Azure-side resources and setting up the simulated on-premises network and supporting resources like Subnets, Gateway Subnets, and so on. Follow through;

Creating the Azure-side resources

This is where resources like the Resource Group (where all the resources will be held), Azure VNet, and define the subnet name services. To do so, run the command below:

az network vnet create \
--resource-group [name of your resource] \
--name Techdirectarchive-VNet-01 \
--address-prefixes 10.0.0.0/16 \
--subnet-name Services \
--subnet-prefixes 10.0.0.0/24

We need to create a Resource Group before creating the resources stated above with the command shown below:

az group create -l eastus -n [YourResourceGroup]
Azure Virtual Networks-RG-Created
Resource Group Created

Few things to note in the screenshot above, the name of the resource group, and the provisioningState.

The name will be required to create the Azure-side resources while the provisioning state simply tells us the creation of the resource group was successful if it shows “Succeeded”.

Now let’s go ahead and run the commands above to create Azure-Side resources. Remember to replace the resource group name with the appropriate name of your resource group.

Azure Virtual Networks-VNet-Succeeded
Creating Azure-Side Resources

From the screenshot, you can see that the VNet name is shown as Techdirectarchive-VNet-01, the provisioning state is succeeded and the VNet is held in the Resource Group named techdirectarchiveRG

Add the Gateway Subnet

Next step, let’s run the following command in the Cloud Shell to add the Gateway Subnet to Techdirectarchive-VNet-01. To do so run the command below:

az network vnet subnet create \
--resource-group techdirectarchiveRG \
--vnet-name Techdirectarchive-VNet-01\
--address-prefixes 10.0.255.0/27 \
--name GatewaySubnet
Azure Virtual Networks-Adding-a-Gateway-Subnet
Adding A Gateway Subnet

All set with adding the Gateway Subnet as shown above.

Create On-premise Network

The next step will be to run the following command in the Cloud Shell to create the TechDirectArchive-HQ-Network that’s the local network gateway. To do so, let’s run:

az network local-gateway create \
--resource-group techdirectarchiveRG \
--gateway-ip-address 94.0.252.140 \
--name TechDirectArchive-HQ-Network \
--local-address-prefixes 172.16.0.0/16
Azure Virtual Networks-Local-Gateway-Subnet
TechDirectArchive-HQ-Network

The local network gateway as shown above for TechDirectArchive Headquarters represents the on-premises network that you’re connecting to. The IP address specified as the remote gateway (which is the simulated on-premises network) will need to be updated later because it doesn’t exist yet in our scenario.

Next, let’s simulate the TechDirectArchive on-premises network by running the following command in the Cloud Shell to create the TechDirectArchive headquarter Network virtual network and the Applications subnet with the command below:

az network vnet create \
--resource-group techdirectarchiveRG \
--name TechDirectArchiveHQ-Network \
--address-prefixes 172.16.0.0/16 \
--subnet-name Applications \
--subnet-prefixes 172.16.0.0/24
HQ-Network
TechDirectArchiveHQ-Network

Create a Local Network Gateway

Next, Let’s run the following command in the Cloud Shell to add Gateway Subnet to Headquarter Network. Run:

az network vnet subnet create \
--resource-group techdirectarchiveRG \
--address-prefixes 172.16.255.0/27 \
--name GatewaySubnet \
--vnet-name TechDirectArchiveHQ-Network
HQ-Network-Gateway-Subnet
TechDirectArchiveHQ-Network Gateway Subnet

Now let’s run the following command in the Cloud Shell to create the TechDirectArchive-Techdirectarchive-VNet-01 local network gateway

az network local-gateway create \
--resource-group techdirectarchiveRG \
--gateway-ip-address 94.0.252.140 \
--name TechDirectArchive-Techdirectarchive-VNet-01 \
--local-address-prefixes 172.16.255.0/27
Local-Subnet
TechDirectArchive-Techdirectarchive-VNet-01 Local Network Gateway

The gateway above describes the Azure network that you’re connecting to. You will need to update the IP address specified as the remote gateway (which is in Azure) later. Now let’s verify the topology

Verifying topology

To verify that we’ve created the virtual networks, we’ll need to run the command below in the Cloud Shell:


az network vnet list --output table
Successfully-created-VNets
Azure Virtual Networks for both Azure and On-Premises

From the screenshot, we created all our VNets for both Azure and On-Premises.

Verify Local Network Gateways

Lastly, we’ll need to also verify that the local network gateways have been successfully created by running the command below in the Cloud Shell:

az network local-gateway list \
--resource-group techdirectarchiveRG \
--output table
Gateway-Subnet-Creation-Successful
Local Network Gateways

Go back and refresh Azure Portal to see that all the resources created above are all there!

REsources-on-Azure
Azure VNet Resources on Azure Portal

Notice that all the resources created are all in the East-US location. This is because the location we chose for the resource group was East-US so they inherited the location of the resource group.

Clean Up

Now that we’ve completed deploying and tested that everything works fine, it’s time to clean up in order to avoid Azure charging for leaving your resource running. To do so, go to the Azure Portal and click on all resources, and delete the resource group. In our case, the name of the resource group is TechdirectarchiveRG.

Why do you need to delete only the Resource Group? It’s because it is the logical folder that holds all the resources we have created so far. SO deleting it will delete all the resources at once instead of having to delete them one after the other. This will save time!🤞

The diagram below shows the network we have just deployed.  You may also want to see the following guides: how to build your first CI/CD Pipeline in Azure DevOps using ASP.Net Core Application, how to secure access to your Virtual Machine with Just-in-Time (JIT) VM Access, and how to provision Azure Resources using Azure Az PowerShell Cmdlet from Cloud Shell

Slide2-1
Azure Virtual Network Topology

Summary

Congratulations! You have just learned about how to prepare Azure and on-premises virtual networks using Azure CLI commands.

Thank you for reading this post. Kindly share it with others.

  • Share on X (Opens in new window) X
  • Share on Reddit (Opens in new window) Reddit
  • Share on LinkedIn (Opens in new window) LinkedIn
  • Share on Facebook (Opens in new window) Facebook
  • Share on Pinterest (Opens in new window) Pinterest
  • Share on Tumblr (Opens in new window) Tumblr
  • Share on Telegram (Opens in new window) Telegram
  • Share on WhatsApp (Opens in new window) WhatsApp
  • Share on Mastodon (Opens in new window) Mastodon
  • Share on Bluesky (Opens in new window) Bluesky
AWS/Azure/OpenShift Tags:Azure, Microsoft Azure

Post navigation

Previous Post: Upgrading from Windows 10 with Unsupported CPU and TPM 1.0
Next Post: RPORT the free and open source remote management tool

Related Posts

  • ouath2final 1 e1786835965613
    How to implement Interactive Authentication using MSAL dotNET AWS/Azure/OpenShift
  • awscli56
    Configure AWS Command Line Interface AWS/Azure/OpenShift
  • Azure AD Logo 1
    How to sync on-premises AD with Azure AD via Azure AD Connect AWS/Azure/OpenShift
  • Generate SSH Keys
    Associate SSH Public key with Azure Linux VM AWS/Azure/OpenShift
  • sonarcloud
    How to Integrate SonarCloud with Azure DevOps Pipeline AWS/Azure/OpenShift
  • Unable to ping an EC2 Instance
    Unable to Ping an EC2 Instance AWS/Azure/OpenShift

More Related Articles

cloudqueryfeature How to Manage Cloud Assets in AWS with CloudQuery AWS/Azure/OpenShift
AADSTS50020 User from Identity Provider does not exist in Tenant AADSTS50020: User from Identity Provider does not exist in Tenant AWS/Azure/OpenShift
images AWS Network Adapter: Redhat to Citrix PV and AWS PV Driver AWS/Azure/OpenShift
AZURE Kubernetes Service upgrade AZURE Kubernetes Service (AKS) upgrade minor version from 1.32.3 to 1.33.7 AWS/Azure/OpenShift
IAM AWS Creating IAM Users, Adding MFA and Policies on AWS AWS/Azure/OpenShift
azure logo 1 How to use the built-in Azure Active Directory Connect tool AWS/Azure/OpenShift

Leave a Reply Cancel reply

You must be logged in to post a comment.

Microsoft MVP

vexpert-badge-stars-5

Virtual Background

VEEAMLEGEND

Categories

Top 30 Sysadmin blog

veeaam100

Veeam Vanguard

  • 517443 637084112713220326 16x9 1
    How can I tell if a password is set for a user account on Linux Linux
  • image
    How to find Computer Serial Number stated change to be filled by OEM Windows Server
  • dfggg 2
    Installing and configuring SimpleSAMLphp [Part 2] Windows Server
  • Hyper V VM creation
    How to Create a Windows Server VM on HyperV Windows Server
  • article 1280x720.192a2586 1
    Veles Software: MPA Tools Review and Product Details Reviews
  • Azure VM Creation With CLI 1
    Deploy a Linux virtual machine (VM) on Azure using the Azure CLI AWS/Azure/OpenShift
  • Printer
    How to rename a Printer in Windows 10 Windows
  • Windows Server vNext
    What’s New? Install Windows Server 2025 on Beelink EQ12 PC Windows

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 1,746 other subscribers
  • RSS - Posts
  • RSS - Comments
  • About
  • Authors
  • Write for us
  • Contact
  • Advertise with us
  • General Terms and Conditions
  • Privacy policy
  • Feedly
  • Telegram
  • Youtube
  • Facebook
  • Instagram
  • LinkedIn
  • Tumblr
  • Pinterest
  • Twitter
  • mastodon
  • Bsky

Tags

Active Directory Azure Bitlocker Microsoft Windows PowerShell WDS Windows 10 Windows 11 Windows Deployment Services Windows Server 2016

Copyright © 2026 TechDirectArchive

Loading Comments...

You must be logged in to post a comment.