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:
- On the main page, select the Azure Cloud Shell button (>_) at the top of the page.
- Choose the Bash environment.
- Select Show advanced settings.
- Set it up as follows:
- Subscription: Default
- Cloud Shell region:
US West
- Resource group: Default
- Storage account: Select Use existing
- File share: Select Use existing and enter cloudshell in the text field
- Select Create storage.
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 the Tab key to automatically populate the resource group name.
- Configure a Subnet for Your New Virtual Network
- Continue to use Azure Cloud Shell to now configure a subnet.
- Choose the Bash environment.
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
Note:
<TAB>
is the Tab key to automatically populate the resource group name.