Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Azure Networking Cookbook
Azure Networking Cookbook

Azure Networking Cookbook: Practical recipes to manage network traffic in Azure, optimize performance, and secure Azure resources

eBook
€8.99 €23.99
Paperback
€29.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
Table of content icon View table of contents Preview book icon Preview Book

Azure Networking Cookbook

Azure Virtual Network

In this very first chapter, you will learn about the basics of Azure networking, including creating Azure Virtual Networks, designing address spaces, and subnets. This will lay the foundation for all future recipes that we'll cover in this book.

We will cover the following recipes in this chapter:

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

Technical requirements

Creating a virtual network in the 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

How to do it...

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

  1. In the Azure portal, select Create a resource and choose Virtual network under Networking services (or, search for virtual network in the search bar).
  2. A new blade will open where we need to provide information for the virtual network to include Name, define Address space, select the Subscription option we want to use, select the Resource group option for where the virtual network will be deployed, select Location (Azure data center) for where the virtual network will be deployed, and define Name and Address range for the first subnet. We also have the option to select what kind of DDoS protection we want to use and if we want to use the Firewall option; an example is shown in the following screenshot:
  1. Creating a virtual network usually doesn't take much time and should be completed in under two minutes. Once deployment is finished, you can start using the virtual network.

How it works...

We deploy virtual networks to Resource group under Subscription in the Azure data center that we choose. Location and Subscription are important parameters; we will only be able to attach Azure resources to this virtual network if they are in the same subscription and region (as the Azure data center). The Address space option defines the number of IP addresses that will be available for our network. It uses the Classless Inter-Domain Routing (CIDR) format and the largest range we can choose is /8. In the portal, we need to create an initial subnet and define the subnet address range. The smallest subnet allowed is /29 and the largest is /8 (however, this can't be larger than the virtual network range).

Creating a virtual network with PowerShell

PowerShell is a command-line shell and scripting language based on the .NET Framework. It's often used by system administrators to automate tasks and manage operating systems. Azure PowerShell is a PowerShell module that allows us to automate and manage Azure resources. Azure PowerShell 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 connect to the Azure subscription from a PowerShell console. Here's the command to do this:

Connect-AzureRmAccount

This will open a new window where we need to input the credentials for the Azure subscription.

Afterward, we need to create a resource group where our virtual network will be deployed:

New-AzureRmResourceGroup -name 'Packt-Networking-Script' -Location 'westeurope'

The output should be similar to the following screenshot:

How to do it...

Deploying Azure Virtual Network is done in a single script. We need to define parameters for the resource group, location, name, and address range. Here is an example script:

New-AzureRmVirtualNetwork -ResourceGroupName 'Packt-Networking-Script' -Location 'westeurope' -Name 'Packt-Script' -AddressPrefix 10.11.0.0/16

You should receive the following output:

How it works...

The difference between deploying of a virtual network from the portal and using PowerShell is that no subnet needs to be defined in PowerShell. The subnet is deployed in a separate command that can be executed either when you are deploying a virtual network or later on. We are going to see this command in the Adding subnets with PowerShell recipe.

Adding a subnet in the portal

Beside 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 use the following steps:

  1. In the virtual network blade, go to the Subnets section.
  2. Select the Add subnet option.
  1. A new blade will open. We need to provide information for the subnet, including Name and Address range in the CIDR format. Address range 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 tables, Service endpoints, and Subnet delegation. These options will be covered in later recipes:
  2. We can also add a gateway subnet in the same blade. To add a gateway subnet, select the Gateway subnet option.

For a gateway subnet, the only parameter we need to define is Address range. The same rules apply as for adding a regular subnet. This time, we don't have to provide a name as it's already defined. You can add only one gateway subnet per virtual network. Service endpoints are not allowed in the gateway subnet:

  1. After the subnets are added, we can see the newly created subnets in the subnet blade under the virtual network:

How it works...

A single virtual network can have a multiple number of subnets defined. Subnets can't overlap and must be in the range of the virtual network address range. For each subnet, four IP addresses are used for management and can't be used. Depending on the network settings, we can define the communication rules between subnets in the virtual network. A gateway subnet is used for VPN connections, and this will be covered in later chapters.

Adding a subnet with PowerShell

When creating 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-AzureRmVirtualNetwork -Name 'Packt-Script' -ResourceGroupName 'Packt-Networking-Script'

How to do it...

  1. To add a subnet to the virtual network, we need to execute a command and provide the name and address prefix. The address prefix is again in CIDR format:
Add-AzureRmVirtualNetworkSubnetConfig -Name FrontEnd -AddressPrefix 10.11.0.0/24 -VirtualNetwork $VirtualNetwork
  1. We need to confirm these changes by executing the following:
$VirtualNetwork | Set-AzureRmVirtualNetwork
  1. We can add an additional subnet by running all commands in a single step, as follows:
$VirtualNetwork = Get-AzureRmVirtualNetwork -Name 'Packt-Script' -ResourceGroupName 'Packt-Networking-Script'
Add-AzureRmVirtualNetworkSubnetConfig -Name BackEnd -AddressPrefix 10.11.1.0/24 -VirtualNetwork $VirtualNetwork
$VirtualNetwork | Set-AzureRmVirtualNetwork

How it works...

The subnet is created and added to the virtual network, but we need to confirm the changes before they can become effective. All the rules when creating or adding subnet size using the Azure portal apply here as well; the subnet must be within the virtual network's address space and cannot overlap with other subnets in the virtual network. The smallest subnet allowed is /29, and the largest is /8.

There's more...

We can create and add multiple subnets in a single script, as follows:

$VirtualNetwork = Get-AzureRmVirtualNetwork -Name 'Packt-Script' -ResourceGroupName 'Packt-Networking-Script'
$FrontEnd = Add-AzureRmVirtualNetworkSubnetConfig -Name FrontEnd -AddressPrefix 10.11.0.0/24 -VirtualNetwork $VirtualNetwork
$BackEnd = Add-AzureRmVirtualNetworkSubnetConfig -Name BackEnd -AddressPrefix 10.11.1.0/24 -VirtualNetwork $VirtualNetwork
$VirtualNetwork | Set-AzureRmVirtualNetwork

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

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 a virtual network blade, locate Address space under Settings.
  2. In the available address space, click on Address space and change the value. An example is shown in the following screenshot:

  1. 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 rules that determine what you can or cannot do. Address space can't be decreased if you have subnets defined in the address space that wouldn't be covered by a new address space. For example, if the address space was in the range of 10.0.0.0/16, it would cover addresses from 10.0.0.1 to 10.0.255.254. If one of the subnets was defined as 10.0.255.0/24, we wouldn't be able to change the virtual network to 10.0.0.0/17, as this will leave the subnet outside the new space.

Address space can't be changed to the new address space if you have subnets defined. In order to completely change the address space, you need to remove all subnets first. For example, if we have the address space defined as 10.0.0.0/16, we wouldn't be able to change it to 10.1.0.0/16, since having any subnets in the old space would leave them in an undefined address range.

Changing the subnet size

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

Getting ready

How to do it...

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

  1. In a virtual network blade, select the Subnets option.
  2. Select the subnet you want to change.
  3. 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 the following screenshot:
  1. After entering a new value, click on Save.
  2. In the Subnets list, you can see the changes applied and the address space has changed, as shown in the following screenshot:

How it works...

When changing subnet size, there are some rules that must be followed. You can't change the address space if it's not within the virtual network address space range and the subnet range can't overlap with other subnets in a virtual network. If devices are assigned to this subnet, you can't change the subnet to exclude the addresses that these devices are already assigned to.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Quickly get up and running with Azure networking solutions
  • Level-up your cloud networking skills by planning, implementing, configuring, and securing your infrastructure network with Azure
  • Leverage Azure networking services to provide applications highly available and fault tolerant environment

Description

Microsoft provides organizations with an effective way of managing their network with Azure's networking services. No matter the size of your organization, Azure provides a way to highly reliable performance and secure connectivity with its networking services. The book starts with an introduction to the Azure networking like creating Azure virtual networks, designing address spaces and subnets. Then you will learn to create and manage network security groups, application security groups, and IP addresses in Azure. Gradually, we move on to various aspects like S2S, P2S, and Vnet2Vnet connections, DNS and routing, load balancers and traffic manager. This book will cover every aspect and function required to deliver practical recipes to help readers learn from basic cloud networking practices to planning, implementing, and securing their infrastructure network with Azure. Readers will not only be able to upscale their current environment but will also learn to monitor, diagnose, and ensure secure connectivity. After learning to deliver a robust environment readers will also gain meaningful insights from recipes on best practices. By the end of this book, readers will gain hands-on experience in providing cost-effective solutions that benefit organizations.

Who is this book for?

This book is targeted towards cloud architects, cloud solution providers, or any stakeholders dealing with networking on the Azure cloud. Some prior understanding of Microsoft Azure will be a plus point.

What you will learn

  • Learn to create Azure networking services
  • Understand how to create and work on hybrid connections
  • Configure and manage Azure network services
  • Learn ways to design high availability network solutions in Azure
  • Discover how to monitor and troubleshoot Azure network resources
  • Learn different methods of connecting local networks to Azure virtual networks

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Mar 30, 2019
Length: 234 pages
Edition : 1st
Language : English
ISBN-13 : 9781789800227
Vendor :
Microsoft
Concepts :
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

Publication date : Mar 30, 2019
Length: 234 pages
Edition : 1st
Language : English
ISBN-13 : 9781789800227
Vendor :
Microsoft
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 99.97
Learn Microsoft Azure
€36.99
Hands-On Kubernetes on Azure
€32.99
Azure Networking Cookbook
€29.99
Total 99.97 Stars icon
Banner background image

Table of Contents

12 Chapters
Azure Virtual Network Chevron down icon Chevron up icon
Virtual Machine Networking Chevron down icon Chevron up icon
Network Security Groups Chevron down icon Chevron up icon
Managing IP Addresses Chevron down icon Chevron up icon
Local and Virtual Network Gateways Chevron down icon Chevron up icon
Creating Hybrid Connections Chevron down icon Chevron up icon
DNS and Routing Chevron down icon Chevron up icon
Load Balancers Chevron down icon Chevron up icon
Traffic Manager Chevron down icon Chevron up icon
Azure Application Gateway Chevron down icon Chevron up icon
Azure Firewall Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
(3 Ratings)
5 star 33.3%
4 star 33.3%
3 star 33.3%
2 star 0%
1 star 0%
Dan Mar 01, 2020
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I am new to Azure and this book really helped me on how to configure various components in Azure
Amazon Verified review Amazon
Win Jun 23, 2020
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
The book is very easy to read with step-by-step instruction and full of figures. In the book, you'll be creating VM, VNet, Submet, NIC, NSG, ASG, VPN, Point-2-Site, Site-2-Site, VNet-2-Vnet, Load Balancers, DNS, Route Table, Traffic Manager, Application Gateway, WAF and Azure Firewall. Each resource is created in two ways - Azure Portal and PowerShell.The reason I deduct one star is although you create a lot of services, you do not validate or test any of those. The book basically shows you how you create those services individually but it doesn't show you how to tie those services together as demo project(s). Another minor thing is the book uses old AzureRM module instead of new Az module.Overall, this is the first book to read for those who are new to Azure IaaS and make yourself familiar with those services.
Amazon Verified review Amazon
Cristian Scutaru Aug 05, 2020
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
The PDF is offered for a free download by Microsoft (Google it).Not a bad book, but extremely verbose for the very simple scenarios it presents. One single example: it takes 18 pages to present how you can create/assign/unassign/remove public/private IPs, with really trivial operations. Through an Azure portal GUI that already changed (as expected) within one single year. Or with PowerShell commands that you must be really specialized on to learn by heart.I would have loved by far some common sense simple visual diagrams, with the relationships between these network objects in Azure.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.