Ask Learn Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
This module requires a sandbox to complete. A sandbox gives you access to free resources. Your personal subscription will not be charged. The sandbox may only be used to complete training on Microsoft Learn. Use for any other reason is prohibited, and may result in permanent loss of access to the sandbox.
Microsoft provides this lab experience and related content for educational purposes. All presented information is owned by Microsoft and intended solely for learning about the covered products and services in this Microsoft Learn module.
Let's say your company is now ready to implement virtual network peering. You want to connect systems that are deployed in different virtual networks. To test this plan, you start by creating virtual networks to support the services your company is already running in Azure. You need three virtual networks:
You're going to create the following resources:
Virtual network | Region | Virtual network address space | Subnet | Subnet address space |
---|---|---|---|---|
SalesVNet | North Europe | 10.1.0.0/16 | Apps | 10.1.1.0/24 |
MarketingVNet | North Europe | 10.2.0.0/16 | Apps | 10.2.1.0/24 |
ResearchVNet | West Europe | 10.3.0.0/16 | Data | 10.3.1.0/24 |
In Cloud Shell, run the following command to create the virtual network and subnet for the Sales systems:
az network vnet create \
--resource-group "[sandbox resource group name]" \
--name SalesVNet \
--address-prefixes 10.1.0.0/16 \
--subnet-name Apps \
--subnet-prefixes 10.1.1.0/24 \
--location northeurope
Run the following command to create the virtual network and subnet for the Marketing systems:
az network vnet create \
--resource-group "[sandbox resource group name]" \
--name MarketingVNet \
--address-prefixes 10.2.0.0/16 \
--subnet-name Apps \
--subnet-prefixes 10.2.1.0/24 \
--location northeurope
Run the following command to create the virtual network and subnet for the Research systems:
az network vnet create \
--resource-group "[sandbox resource group name]" \
--name ResearchVNet \
--address-prefixes 10.3.0.0/16 \
--subnet-name Data \
--subnet-prefixes 10.3.1.0/24 \
--location westeurope
Let's take a quick look at what you created.
View the virtual networks you've created by running the following command in Cloud Shell:
az network vnet list --query "[?contains(provisioningState, 'Succeeded')]" --output table
Your output should look like this example:
Location Name EnableDdosProtection ProvisioningState ResourceGuid ResourceGroup
----------- ------------- ---------------------- ------------------- ------------------------------------ ------------------------------------------
westeurope ResearchVNet False Succeeded 9fe09fe0-d6cd-4043-aba8-b5e850a91251 learn-cb081b92-bc67-49cf-a965-1aeb40a2e25c
northeurope SalesVNet False Succeeded 8f030706-cce4-4a7b-8da2-a9f738887ffd learn-cb081b92-bc67-49cf-a965-1aeb40a2e25c
northeurope MarketingVNet False Succeeded ffbf8430-b0eb-4c3d-aa94-3b3156b90bed learn-cb081b92-bc67-49cf-a965-1aeb40a2e25c
Now, you deploy some Ubuntu virtual machines (VMs) in each of the virtual networks. These VMs simulate the services in each virtual network. In the final unit of this module, you use these VMs to test connectivity between the virtual networks.
In Cloud Shell, run the following command, replacing <password>
with a password that meets the requirements for Linux VMs, to create an Ubuntu virtual machine (VM) in the Apps subnet of SalesVNet. Note this password for later use.
az vm create \
--resource-group "[sandbox resource group name]" \
--no-wait \
--name SalesVM \
--location northeurope \
--vnet-name SalesVNet \
--subnet Apps \
--image Ubuntu2204 \
--admin-username azureuser \
--admin-password <password>
Note
The --no-wait
parameter in this command lets you continue working in Cloud Shell while the VM is building.
Run the following command, replacing <password>
with a password that meets the requirements for Linux VMs, to create another Ubuntu VM in the Apps subnet of MarketingVNet. Note this password for later use. The VM might take a minute or two to be created.
az vm create \
--resource-group "[sandbox resource group name]" \
--no-wait \
--name MarketingVM \
--location northeurope \
--vnet-name MarketingVNet \
--subnet Apps \
--image Ubuntu2204 \
--admin-username azureuser \
--admin-password <password>
Run the following command, replacing <password>
with a password that meets the requirements for Linux VMs, to create an Ubuntu VM in the Data subnet of ResearchVNet. Note this password for later use.
az vm create \
--resource-group "[sandbox resource group name]" \
--no-wait \
--name ResearchVM \
--location westeurope \
--vnet-name ResearchVNet \
--subnet Data \
--image Ubuntu2204 \
--admin-username azureuser \
--admin-password <password>
The VMs might take several minutes to reach a running state.
To confirm that the VMs are running, run the following command. The Linux watch
command is configured to refresh every five seconds.
watch -d -n 5 "az vm list \
--resource-group "[sandbox resource group name]" \
--show-details \
--query '[*].{Name:name, ProvisioningState:provisioningState, PowerState:powerState}' \
--output table"
A ProvisioningState of Succeeded and a PowerState of VM running indicates a successful deployment for the VM.
When your VMs are running, you're ready to move on. Press Ctrl-c
to stop the command and continue on with the exercise.
Having an issue? We can help!
Please sign in to use this experience.
Sign in