0% found this document useful (0 votes)
59 views

Prepare Azure and On-Premises Virtual Networks by Using Azure CLI Commands

The document details creating Azure resources including two virtual networks, three subnets, and two local network gateways to represent networks in Azure and an on-premises location. It provides Azure CLI commands to create each resource and a final command to verify the topology has been created correctly.

Uploaded by

thienvugcs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views

Prepare Azure and On-Premises Virtual Networks by Using Azure CLI Commands

The document details creating Azure resources including two virtual networks, three subnets, and two local network gateways to represent networks in Azure and an on-premises location. It provides Azure CLI commands to create each resource and a final command to verify the topology has been created correctly.

Uploaded by

thienvugcs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Create the Azure-side resources

Run the following command in Azure Cloud Shell to create the Azure-VNet-1 virtual network and
the Services subnet.

Azure CLI

az network vnet create --resource-group learn-d0f06a92-b129-4d9f-9178-d441b5318722 --name Azure-VNet-1 --address-


prefixes 10.0.0.0/16 --subnet-name Services --subnet-prefixes 10.0.0.0/24
Run the following command in Cloud Shell to add the GatewaySubnet subnet to Azure-VNet-1.

az network vnet subnet create --resource-group learn-d0f06a92-b129-4d9f-9178-d441b5318722 --vnet-name Azure-VNet-


1 --address-prefixes 10.0.255.0/27 --name GatewaySubnet

Run the following command in Cloud Shell to create the LNG-HQ-Network local network gateway.

Azure CLI
az network local-gateway create --resource-group learn-d0f06a92-b129-4d9f-9178-d441b5318722 --gateway-ip-address
94.0.252.160 --name LNG-HQ-Network --local-address-prefixes 10.1.0.0/16

This gateway 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) must be updated later because it doesn't exist yet
in our scenario.

Create the simulated on-premises network and supporting


resources
Run the following command in Cloud Shell to create the HQ-Network virtual network and
the Applications subnet.

Azure CLI

az network vnet create --resource-group learn-d0f06a92-b129-4d9f-9178-d441b5318722 --name HQ-Network --address-


prefixes 172.16.0.0/16 --subnet-name Applications --subnet-prefixes 172.16.0.0/24
Run the following command in Cloud Shell to add GatewaySubnet to HQ-Network.

Azure CLI
az network vnet subnet create --resource-group learn-d0f06a92-b129-4d9f-9178-d441b5318722 --address-prefixes
172.16.255.0/27 --name GatewaySubnet --vnet-name HQ-Network

Run the following command in Cloud Shell to create the LNG-Azure-VNet-1 local network gateway.

Azure CLI
az network local-gateway create --resource-group learn-d0f06a92-b129-4d9f-9178-d441b5318722 --gateway-ip-address
94.0.252.160 --name LNG-Azure-VNet-1 --local-address-prefixes 172.16.255.0/27
Verify the topology
1. Run the following command in Cloud Shell to verify that the virtual networks have been
successfully created.

Azure CLI
az network vnet list --output tsv

vu [ ~ ]$ az network vnet list --output tsv

False W/"9baef492-d6de-428f-9025-6ccb8b792302"
/subscriptions/963ead10-d6fa-4fdb-925f-f6ba93e4af5e/resourceGroups/learn-d0f06a92-b129-4d9f-9178-
d441b5318722/providers/Microsoft.Network/virtualNetworks/Azure-VNet-1 westus Azure-VNet-1 Succeeded
learn-d0f06a92-b129-4d9f-9178-d441b5318722 39721fa3-4696-4bd6-aca0-3f6ec9eb2225 2
Microsoft.Network/virtualNetworks 0

False W/"b2bbebfd-1e89-48b8-b12b-03dfabab4f74"
/subscriptions/963ead10-d6fa-4fdb-925f-f6ba93e4af5e/resourceGroups/learn-d0f06a92-b129-4d9f-9178-
d441b5318722/providers/Microsoft.Network/virtualNetworks/HQ-Network westus HQ-Network Succeeded
learn-d0f06a92-b129-4d9f-9178-d441b5318722 4f5d47a0-c2be-4e6f-b978-0a105cc8e538 2
Microsoft.Network/virtualNetworks 0

vu [ ~ ]$

Run the following command in Cloud Shell to verify that the local network gateways have been
successfully created.

Azure CLI
az network local-gateway list --resource-group learn-d0f06a92-b129-4d9f-9178-d441b5318722 --output table

vu [ ~ ]$ az network local-gateway list --resource-group learn-d0f06a92-b129-4d9f-9178-d441b5318722 --output table

Name Location ResourceGroup ProvisioningState GatewayIpAddress AddressPrefixes

---------------- ---------- ------------------------------------------ ------------------- ------------------ -----------------


LNG-Azure-VNet-1 westus learn-d0f06a92-b129-4d9f-9178-d441b5318722 Succeeded 94.0.252.160
172.16.255.0/27

LNG-HQ-Network westus learn-d0f06a92-b129-4d9f-9178-d441b5318722 Succeeded 94.0.252.160


10.1.0.0/16

vu [ ~ ]$

You might also like