Alternatively, we can create an NSG rule using Azure PowerShell. This command can be executed right after the NSG has been created, allowing us to create and configure NSG in a single script. This way, we can standardize deployment and have rules applied each time an NSG is created.
Creating a new NSG rule with PowerShell
Getting ready
Open the PowerShell console and make sure you are connected to your Azure subscription.
How to do it...
To create a new NSG rule, execute the following command:
$nsg = Get-AzureRmNetworkSecurityGroup -Name 'nsg1' -ResourceGroupName...