To add an inbound or an outbound rule, you can use either the portal, CLI, or PowerShell. In the portal, the configuration is available via the following blade:
Figure 3.26 – Inbound security rules blade
For the Azure CLI, you can use the following command (in the following example, we opened port 3389 for the RDP activities on Windows):
$ az network nsg rule create -g azureadministrator-euw-rg --nsg-name myfirstnsg-euw-nsg -n AllowRDP --priority 1000 --access Allow --direction Inbound --source-port-ranges 3389 --destination-port-ranges 3389
The preceding command creates a new rule with priority 1000, allowing inbound access on port 3389 to port 3389. For Azure PowerShell, you will have to use the New-AzureRmNetworkSecurityRuleConfig command:
Figure 3.27 – Cmdlet details shown in the PowerShell ISE
As you can see, there are many different parameters available to be set—you can prepare very detailed rules that combine different...