O'Reilly logo

Hands-On Networking with Azure by Mohamed Waly

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating NSG using PowerShell

First off, you need to create a security rule and to do it, you need to run the following cmdlet:

$InboundRule = New-AzureRmNetworkSecurityRuleConfig -Name AllowingHTTP -Description "Allow HTTP" -Access Allow -Protocol Tcp -Direction Inbound -Priority 100 -SourceAddressPrefix Internet -SourcePortRange * -DestinationAddressPrefix * -DestinationPortRange 80

Then, you can create the NSG with the previous rule added to it by running the following cmdlet:

$NSG = New-AzureRmNetworkSecurityGroup -ResourceGroupName PacktPub -Location westeurope -Name PSNSG -SecurityRules $InboundRule

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required