Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Azure Networking Cookbook, Second Edition - Second Edition

You're reading from  Azure Networking Cookbook, Second Edition - Second Edition

Product type Book
Published in Dec 2020
Publisher Packt
ISBN-13 9781800563759
Pages 298 pages
Edition 2nd Edition
Languages
Concepts
Author (1):
Mustafa Toroman Mustafa Toroman
Profile icon Mustafa Toroman

Table of Contents (15) Chapters

Preface 1. Azure Virtual Network 2. Virtual machine networking 3. Network Security Groups 4. Managing IP addresses 5. Local and virtual network gateways 6. DNS and routing 7. Azure Firewall 8. Creating hybrid connections 9. Connecting to resources securely 10. Load balancers 11. Traffic Manager 12. Azure Application Gateway and Azure WAF 13. Azure Front Door and Azure CDN Index

1. Azure Virtual Network

In this very first chapter, we will learn about the basics of Azure networking, including creating Azure virtual networks and designing address spaces and subnets. This will lay the foundation for all future recipes that will be covered in this chapter.

We will cover the following recipes in this chapter:

  • Creating a virtual network in the Azure portal
  • Creating a virtual network with PowerShell
  • Adding a subnet in the Azure portal
  • Adding a subnet with PowerShell
  • Changing the address space size
  • Changing the subnet size

Technical requirements

For this chapter, the following is required:

  • An Azure subscription
  • Azure PowerShell

The code samples can be found at https://github.com/PacktPublishing/Azure-Networking-Cookbook-Second-Edition/tree/master/Chapter01.

Creating a virtual network in the Azure portal

Azure Virtual Network represents your local network in the cloud. It enables other Azure resources to communicate over a secure private network without exposing endpoints over the internet.

Getting ready

Before you start, open a web browser and go to the Azure portal at https://portal.azure.com.

How to do it…

In order to create a new virtual network using the Azure portal, take the following steps:

  1. In the Azure portal, select Create a resource and choose Virtual network under Networking (or search for virtual network in the search bar). A new pane will open, where we need to provide information for the virtual network. First, select the Subscription option we want to use and the Resource group option for where the virtual network will be deployed. Then, include a name and select a region (of the Azure datacenter) for where the virtual network will be deployed. An example is shown in Figure 1.1:
    Creating a virtual network in the Basics pane
    Figure 1.1: Creating...

Creating a virtual network with PowerShell

PowerShell is a command-line shell and scripting language based on .NET Framework. It's often used by system administrators to automate tasks and manage operating systems. Azure PowerShell Az is a PowerShell module that allows us to automate and manage Azure resources. Az is also very often used to automate deployment tasks and can also be used to deploy a new Azure virtual network.

Getting ready

Before we start, we need to make sure that we have the latest Az modules installed. To install Az modules, we need to run this command in the PowerShell console:

Install-Module -Name Az -AllowClobber -Scope CurrentUser

For more information, you can visit https://docs.microsoft.com/powershell/azure/install-az-ps?view=azps-4.5.0.

Before we start, we need to connect to the Azure subscription from a PowerShell console. Here's the command to do this:

Connect-AzAccountAzAccount

This will open a pop-up window where we need...

Adding a subnet in the Azure portal

In addition to adding subnets while creating a virtual network, we can add additional subnets to our network at any time.

Getting ready

Before you start, open a web browser and go to the Azure portal at https://portal.azure.com. Here, locate the previously created virtual network.

How to do it…

In order to add a subnet to a virtual network using the Azure portal, we must take the following steps:

  1. In the Virtual network pane, go to the Subnets section.
  2. Select the Add subnet option.
  3. A new pane will open. We need to provide information for the subnet, including the Name value and the Address range value in CIDR format. The Address range value must be in the range limit of the virtual network address range and cannot overlap with the address range of other subnets in the virtual network. Optionally, we can add information for Network security group, Route table, Service endpoints, and Subnet delegation. These options...

Adding a subnet with PowerShell

When creating an Azure virtual network with PowerShell, a subnet is not created in the same step and requires an additional command to be executed separately.

Getting ready

Before creating a subnet, we need to collect information about the virtual network that the new subnet will be associated with. The parameters that need to be provided are the name of the virtual network and the resource group that the virtual network is located in:

$VirtualNetwork = Get-AzVirtualNetwork -Name 'Packt-Script' -ResourceGroupName 'Packt-Networking-Script'

How to do it…

  1. To add a subnet to the virtual network using PowerShell, we need to execute a command and provide the name and address prefix. The address prefix is again in CIDR format:
    Add-AzVirtualNetworkSubnetConfig -Name FrontEnd -AddressPrefix 10.11.0.0/24 -VirtualNetwork $VirtualNetwork
  2. We need to confirm these changes by executing the following command:
    $VirtualNetwork...

Changing the address space size

After the initial address space is defined during the creation of a virtual network, we can still change the address space size as needed. We can either increase or decrease the size of the address space or change the address space completely by using a new address range.

Getting ready

Before you start, open a web browser and go to the Azure portal at https://portal.azure.com.

How to do it…

In order to change the address space size for a virtual network using the Azure portal, we must observe the following steps:

  1. In the Virtual network pane, locate Address space under Settings.
  2. Next, click on Address space and change the value to the desired range. An example is shown in Figure 1.11:
    Changing the address space value to the desired range in the Address space pane
    Figure 1.11: Changing the address space range
  3. After you have entered a new value for Address space, click Save to apply the changes.

How it works…

Although you can change the address space at any time, there are some...

Changing the subnet size

Similar to the virtual network address space, we can change the size of a subnet at any time.

Getting ready

Before you start, open a web browser and go to the Azure portal at https://portal.azure.com.

How to do it…

In order to change the subnet size using the Azure portal, we must take the following steps:

  1. In the Virtual network pane, select the Subnets option.
  2. Select the subnet you want to change. In the Subnets option, enter a new value for the subnet size under Address range. An example of how to do this is shown in Figure 1.12:
    Entering the new value in the address range of the FrontEnd pane
    Figure 1.12: Changing the subnet size using the Azure portal
  3. After entering a new address range value, click Save.
  4. In the Subnets list, you can see that the changes have been applied and the address space has changed, as shown in Figure 1.13:
    Viewing the changes that are applied in the address space
Figure 1.13: Viewing changes made in the subnet address range

How it works…

When changing the subnet size, there are...

lock icon The rest of the chapter is locked
You have been reading a chapter from
Azure Networking Cookbook, Second Edition - Second Edition
Published in: Dec 2020 Publisher: Packt ISBN-13: 9781800563759
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}