Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Azure Networking Cookbook

You're reading from   Azure Networking Cookbook Practical recipes to manage network traffic in Azure, optimize performance, and secure Azure resources

Arrow left icon
Product type Paperback
Published in Mar 2019
Publisher Packt
ISBN-13 9781789800227
Length 234 pages
Edition 1st Edition
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Mustafa Toroman Mustafa Toroman
Author Profile Icon Mustafa Toroman
Mustafa Toroman
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. Azure Virtual Network 2. Virtual Machine Networking FREE CHAPTER 3. Network Security Groups 4. Managing IP Addresses 5. Local and Virtual Network Gateways 6. Creating Hybrid Connections 7. DNS and Routing 8. Load Balancers 9. Traffic Manager 10. Azure Application Gateway 11. Azure Firewall 12. Other Books You May Enjoy

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.

lock icon The rest of the chapter is locked
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 $19.99/month. Cancel anytime