0% found this document useful (0 votes)
60 views4 pages

Creating A Virtual Network in Azure Using Azure CLI

This document provides instructions for creating a Virtual Network in Azure using the Azure CLI. It describes logging into the Azure portal, creating a VNet named 'vnet1' with an address prefix of 10.1.0.0/16, and adding a subnet named 'subnet1' with an address prefix of 10.1.1.0/24 to the new VNet.

Uploaded by

Gowrisankari S
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)
60 views4 pages

Creating A Virtual Network in Azure Using Azure CLI

This document provides instructions for creating a Virtual Network in Azure using the Azure CLI. It describes logging into the Azure portal, creating a VNet named 'vnet1' with an address prefix of 10.1.0.0/16, and adding a subnet named 'subnet1' with an address prefix of 10.1.1.0/24 to the new VNet.

Uploaded by

Gowrisankari S
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/ 4

Creating a Virtual Network in

Azure Using Azure CLI


Description
Virtual Networks (VNet) are a core and common part of many solutions that you can
build within Azure. Using a VNet, we can provide private connectivity between
resources in Azure.

In this lab, you will have the opportunity to create a VNet using Azure CLI. Through
the Azure CLI, we can create resources within Azure that can help automate and
improve consistency for many administrative tasks that you would otherwise
complete manually through the Azure Portal.

After completing this lab, you'll be familiar with how to create a VNet, and modify
subnet configuration, using Azure CLI.

Objectives
Successfully complete this lab by achieving the following learning objectives:
Create a Virtual Network
Do the following to create a virtual network with the Azure CLI:

1. On the main page, select the Azure Cloud Shell button, >_, at the top of the
page.
2. Choose the Bash environment.
3. Select Show advanced settings.
4. Set it up as follows:
o Subscription: Use the lab provided subscription
o Cloud Shell region: Put the same region as your lab's provided storage
account.
o Resource group: Use existing. It will then pre-populate.
o Storage account: Select Use existing
o File share: Select Create new
5. Select Create storage.
6. Once in the shell, enter the following to create the Virtual Network

az network vnet create --name "vnet1" --resource-group <TAB>


--address-prefixes 10.1.0.0/16

<TAB> is the Tab key to automatically populate the resource group name.

Configure a Subnet for your new Virtual Network


1. Continue to use Azure Cloud Shell to now configure a subnet.
2. Choose the Bash environment.

3. Once in the shell, enter the following to create a subnet for the Virtual
Network you created earlier:

az network vnet subnet create --name "subnet1" --vnet-name


"vnet1" --resource-group <TAB> --address-prefixes 10.1.1.0/24

<TAB> is the Tab key to automatically populate the resource group name.

Credentials
How do I connect?
Azure portal Account
Username
cloud_user_p_3d84ebb8…
Password
S88eAAcl#xs7nTfg3Jj7

Open Link in Incognito Window

How do I connect?

Additional Resources
You have recently been hired by The Pupper Camp (TPC), a dog services company
that has offices across the world.

The Pupper Camp runs a series of projects throughout the year, where a range of
Azure-hosted infrastructure is required each time.

Your IT manager has asked you to test whether Azure CLI can be used to create a
Virtual Network (VNet) with a single subnet, as she would like for this to be
automated for projects throughout the year.

Learning Objectives
0 of 2 completed
Create a Virtual Network
Do the following to create a virtual network with the Azure CLI:

1. On the main page, select the Azure Cloud Shell button, >_, at the top of
the page.
2. Choose the Bash environment.
3. Select Show advanced settings.
4. Set it up as follows:
o Subscription: Use the lab provided subscription
o Cloud Shell region: Put the same region as your lab's provided
storage account.
o Resource group: Use existing. It will then pre-populate.
o Storage account: Select Use existing
o File share: Select Create new
5. Select Create storage.
6. Once in the shell, enter the following to create the Virtual Network

az network vnet create --name "vnet1" --resource-group <TAB>


--address-prefixes 10.1.0.0/16

<TAB> is the Tab key to automatically populate the resource group name.

Configure a Subnet for your new Virtual Network

1. Continue to use Azure Cloud Shell to now configure a subnet.


2. Choose the Bash environment.

3. Once in the shell, enter the following to create a subnet for the Virtual
Network you created earlier:

az network vnet subnet create --name "subnet1" --vnet-name


"vnet1" --resource-group <TAB> --address-prefixes
10.1.1.0/24

<TAB> is the Tab key to automatically populate the resource group name.

Creating a Virtual Network in Azure


Using Azure CLI
In this lab, we will test whether Azure CLI can be used to create a Virtual Network
(VNet) with a single subnet.

Before We Begin

To get started, we need to log into the Azure Portal using the provided credentials.

Create A Virtual Network


Do the following to create a virtual network with the Azure CLI:

1. On the main page, select the Azure Cloud Shell button, >_, at the top of the page.
2. Choose the Bash environment.
3. Select Show advanced settings.
4. Set it up as follows:
o Subscription: Use the lab provided subscription
o Cloud Shell region: Put the same region as your lab's provided storage
account.
o Resource group: Use existing. It will then pre-populate.
o Storage account: Select Use existing
o File share: Select Create new
5. Select Create storage.
6. Once in the shell, enter the following to create the Virtual Network:

az network vnet create --name "vnet1" --resource-group <TAB>


--address-prefixes 10.1.0.0/16

Note: <TAB> is pressing the Tab key to populate the resource group name
automatically.

Configure a Subnet for Your New Virtual Network


With our virtual network created, we can create a subnet:

1. In the shell, enter the following to create a subnet for the Virtual Network we
created earlier:

az network vnet subnet create --name "subnet1" --vnet-name


"vnet1" --resource-group <TAB> --address-prefixes 10.1.1.0/24

Note: <TAB> is the Tab key to populate the resource group name automatically.

Check Your Work


To make sure that our virtual network and subnet were created correctly, complete
the following:

1. Back in the Azure portal, on the All Resources page, select Refresh.
2. Select the virtual network we created.
3. Under the Settings section, select Subnets and check that our subnet exists.

Conclusion
Congratulations! You've completed the lab.

You might also like