Creating a Virtual Network in Azure Using Azure CLI

Get Started
45 minutes
  • 2 Learning Objectives

About this Hands-on Lab

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.

Learning 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:
    • Subscription: Use the lab provided subscription
    • Cloud Shell region: Put the same region as your lab’s provided storage account.
    • Resource group: Use existing. It will then pre-populate.
    • Storage account: Select Use existing
    • 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.

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.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!
Thanks for reaching out!

You’ll hear from us shortly. In the meantime, why not check out what our customers have to say about ACG?