Implement Virtual Networking

Implement Virtual Networking

Create and configure a virtual network

To create a virtual network with multiple subnets, follow the steps below.

1. Sign in to the Azure Portal.

2. In the Azure portal, search for and select Virtual networks, and, on the Virtual networks blade, click + Create.

Article content

3. Create a virtual network with the settings you need. 

Article content

4. Click Next: IP Addresses. Enter the Starting address. In our example it is 10.40.0.0. The Address space size is /20.

Article content

5. Click + Add subnet, enter the values according to your reality, and then click Add. Accept the defaults and click Review and Create.

Article content

6. Let validation occur and hit Create again to submit your deployment.

Article content

Note: Wait for the virtual network to be provisioned.

7. Click on Go to resource.

8. On the virtual network blade, click Subnets and then click + Subnet.

Article content

9. Create a subnet with your settings and click Save.

Article content

Deploy virtual machines into the virtual network

You will deploy Azure virtual machines into different subnets of the virtual network by using an ARM template. To do this, follow the steps.

1. In the Azure portal, open the Azure Cloud Shell by clicking on the icon in the top right of the Azure Portal.

2. If prompted to select either Bash or PowerShell, select PowerShell.

3. In the toolbar of the Cloud Shell pane, click the Upload/Download files icon, in the drop-down menu, click Upload. Upload your template and parameters json into the Cloud Shell home directory.

Note: You must upload each file separately. After uploading, use dir to ensure both files were successfully uploaded.

Article content

4. From the Cloud Shell pane, run the following to deploy two virtual machines by using the template and parameter files:

$rgName = 'az104-04-rg1'

New-AzResourceGroupDeployment `
   -ResourceGroupName $rgName `
   -TemplateFile $HOME/az104-04-vms-loop-template.json `
   -TemplateParameterFile $HOME/az104-04-vms-loop-parameters.json        

Note: This method of deploying ARM templates uses Azure PowerShell. You can perform the same task by running the equivalent Azure CLI command az deployment create (for more information, refer to Deploy resources with Resource Manager templates and Azure CLI.

Note: Wait for the deployment to complete before proceeding to the next task. This should take about 2 minutes.

Article content

5. Close the Cloud Shell pane.

Configure private and public IP addresses of Azure VMs

Here you will configure static assignment of public and private IP addresses assigned to network interfaces of Azure virtual machines.

Note: Private and public IP addresses are actually assigned to the network interfaces, which, in turn are attached to Azure virtual machines, however, it is fairly common to refer to IP addresses assigned to Azure VMs instead.

1. In the Azure portal, search for and select Resource groups, and, on the Resource groups blade, click the Resource Group where you have the vnet you want to modify. In our example, it is az104-04-rg1.

Article content

2. On the az104-04-rg1 resource group blade, in the list of its resources, click on the vnet you want to modify. In our case, az104-04-vnet1.

Article content

3. On the az104-04-vnet1 virtual network blade, review the Connected devices section and verify that there are two network interfaces az104-04-nic0 and az104-04-nic1 attached to the virtual network.

Article content

4. Click az104-04-nic0 and, on the az104-04-nic0 blade, click IP configurations.

Article content

Note: Verify that ipconfig1 is currently set up with a dynamic private IP address.

5. In the list IP configurations, click ipconfig1.

6. On the ipconfig1 blade, in the Public IP address settings section, select Associate, click + Create new, specify the settings you need it, and click OK.

Article content

7. On the ipconfig1 blade, set Assignment to Static, leave the default value of IP address set to 10.40.0.4. Click Save.

Article content

8. Back on the ipconfig1 blade, save the changes. Make sure to wait for the save operation to be completed before you proceed to the next step.

9. Navigate back to the az104-04-vnet1 blade.

10. Click az104-04-nic1 and, on the az104-04-nic1 blade, click IP configurations.

Article content

Note: Verify that ipconfig1 is currently set up with a dynamic private IP address.

11. In the list IP configurations, click ipconfig1.

12. On the ipconfig1 blade, in the Public IP address settings section, select Associate, click + Create new, specify your settings, and click OK.

Article content

13. On the ipconfig1 blade, set Assignment to Static, leave the default value of IP address set to 10.40.1.4.

Article content

14. Back on the ipconfig1 blade, save the changes.

15. Navigate back to the az104-04-rg1 resource group blade, in the list of its resources, click az104-04-vm0.

Article content

16. From the az104-04-vm0 virtual machine blade, note the public IP address entry.

Article content

17. Navigate back to the az104-04-rg1 resource group blade, in the list of its resources, click az104-04-vm1, and from the az104-04-vm1 virtual machine blade, note the public IP address entry.

Article content

Configure network security groups

Here you will configure network security groups in order to allow for restricted connectivity to Azure virtual machines.

1. In the Azure portal, search for and select Network Security Groups, and, on the Network Security Groups blade, click + Create.

Article content

2. Create a network security group with the settings you need.

Article content

3. Click Review and Create. Let validation occur and hit Create to submit your deployment.

Note: Wait for the deployment to complete. This should take about 2 minutes.

4. On the deployment blade, click Go to resource to open the az104-04-nsg01 network security group blade.

Article content

5. On the az104-04-nsg01 network security group blade, in the Settings section, click Inbound security rules.

Article content

6. Add an inbound rule informing the necessary settings in the Add inbound security rule blade and click Add.

Article content

7. On the az104-04-nsg01 network security group blade, in the Settings section, click Network interfaces and then click + Associate.

Article content

8. Associate the az104-04-nsg01 network security group with the az104-04-nic0 and az104-04-nic1 network interfaces.

Article content

Note: It may take up to 5 minutes for the rules from the newly created Network Security Group to be applied to the Network Interface Card.

9. Start the az104-04-vm0 and az104-04-vm1 virtual machines.

Article content

10. Navigate back to the az104-04-vm0 virtual machine blade.

11. On the az104-04-vm0 blade, click Connect.

Article content

12. Click RDP. Click Download RDP File using the Public IP address and follow the prompts to start the Remote Desktop session.

Article content

Note: This step refers to connecting via Remote Desktop from a Windows computer. On a Mac, you can use Remote Desktop Client from the Mac App Store and on Linux computers you can use an open source RDP client software.

13. When prompted, sign in with the user and password.

Configure Azure DNS for internal name resolution

To configure DNS name resolution within a virtual network by using Azure private DNS zones, follow the steps below.

1. In the Azure portal, search for and select Private DNS zones and, on the Private DNS zones blade, click + Create.

Article content

2. Create a private DNS zone. Enter the settings you need.

Article content

3. Click Review and Create. Let validation occur and hit Create again to submit your deployment.

Note: Wait for the private DNS zone to be created. This should take about 2 minutes.

4. Click Go to resource to open the contoso.org DNS private zone blade.

5. On the contoso.org private DNS zone blade, in the Settings section, click Virtual network links, and then  + Add.

Article content

6. Create a virtual network link with the settings you need.

Article content

7. Click OK.

Note: Wait for the virtual network link to be created. This should take less than 1 minute.

8. On the contoso.org private DNS zone blade, in the sidebar, click Overview.

9. Verify that the DNS records for az104-04-vm0 and az104-04-vm1 appear in the list of record sets as Auto registered.

Article content

Note: You might need to wait a few minutes and refresh the page if the record sets are not listed.

10. Switch to the Remote Desktop session to az104-04-vm0, right-click the Start button and, in the right-click menu, click Windows PowerShell (Admin).

11. In the Windows PowerShell console window, run the following to test internal name resolution in the newly created private DNS zone:

nslookup az104-04-vm0.contoso.org
nslookup az104-04-vm1.contoso.org        

12. Verify that the output of the command includes the private IP address of az104-04-vm1 (10.40.1.4).

Article content

Configure Azure DNS for external name resolution

Configure external DNS name resolution by using Azure public DNS zones.

1. In the Azure portal, search for and select DNS zones and, on the DNS zones blade, click + Create.

Article content

2. Create a DNS zone with the settings you need.

Article content

3. Click Review and Create. Let validation occur and hit Create again to submit your deployment.

Note: Wait for the DNS zone to be created. This should take about 2 minutes.

4. Click Go to resource to open the blade of the newly created DNS zone.

5. On the DNS zone blade, click + Record set.

Article content

6. Add a record set with your necessary settings.

Article content

7. Click OK.

8. On the DNS zone blade, click + Record set.

9. Add a record set set with your necessary settings.

Article content

10. Click OK.

11. On the DNS zone blade, note the name of the Name server 1 entry.

Article content

12. In the Azure portal, open the PowerShell session in Cloud Shell by clicking on the icon in the top right of the Azure Portal.

13. From the Cloud Shell pane, run the following to test external name resolution of the az104-04-vm0 DNS record set in the newly created DNS zone (replace the placeholder [Name server 1] with the name of Name server 1 you noted earlier in this task and the [domain name] placeholder with the name of the DNS domain you created earlier in this task):

nslookup az104-04-vm0.[domain name] [Name server 1]        

14. Verify that the output of the command includes the public IP address of az104-04-vm0.

Article content

15. From the Cloud Shell pane, run the following to test external name resolution of the az104-04-vm1 DNS record set in the the newly created DNS zone (replace the placeholder [Name server 1] with the name of Name server 1 you noted earlier in this task and the [domain name] placeholder with the name of the DNS domain you created earlier in this task):

nslookup az104-04-vm1.[domain name] [Name server 1]        

16. Verify that the output of the command includes the public IP address of az104-04-vm1.

Article content


To view or add a comment, sign in

More articles by Marcelo Leite Gomes

  • Implement Data Protection

    Provision the lab environment For the last chapter, we will deploy two virtual machines that will be used to test…

    1 Comment
  • Implement Azure Kubernetes Service

    Register the Microsoft.Kubernetes and Microsoft.

    1 Comment
  • Implement Azure Container Instances

    Deploy a Docker image by using the Azure Container Instance In this task, you will create a new container instance for…

    1 Comment
  • Implement Web Apps

    Create an Azure web app In this task, we will create an Azure web app. 1.

    1 Comment
  • Manage Virtual Machines

    Deploy zone-resilient Azure virtual machines by using the Azure portal and an Azure Resource Manager template In this…

  • Manage Azure Storage

    Let’s manage some files? The idea is the following, you need to evaluate the use of Azure storage for storing files…

    1 Comment
  • Implement Traffic Management

    Azure Traffic Manager operates at the DNS layer to quickly and efficiently direct incoming DNS requests based on the…

  • Implement Intersite Connectivity

    Your company has offices in three different locations, and the data center of these offices are connected via mesh wide…

  • Manage Azure resources by Using Azure CLI

    Start a Bash session in Azure Cloud Shell 1. From the portal, open the Azure Cloud Shell by clicking on the icon in the…

  • Manage Azure resources by Using Azure PowerShell

    Create a Resource Group and an Azure managed disk by using Azure PowerShell To create a resource group in the same…

Insights from the community

Others also viewed

Explore topics