Azure / Azure/azure-powershell
Input validation in New/Set-AzureRmNetworkSecurityRuleConfig
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 4.3k
- Avg merge
- 3d 14h
- Merged PRs (30d)
- 54
Description
Could you validate Input parameter in New/Set-AzureRmNetworkSecurityRuleConfig cmdlets?
In spite of incorrect Address Prefix, following commands return no sign of error.
NSG permits or denies unexpected packets when I link these rules to NIC or Subnet.
It is difficult to find misconfiguration in case if these cmdlets doesn't return any errors.
- Creating NSG with incorrect Address Prefix (192.168.0.0/34 and 10.0.0/0/16)
> $rule1 = New-AzureRmNetworkSecurityRuleConfig -Name rdp-rule -Description "Allow RDP" -Access Allow -Protocol Tcp -Direction Inbound -Priority 100 -SourceAddressPrefix 192.168.0.0/34 -SourcePortRange \* -DestinationAddressPrefix \* -DestinationPortRange 3389
> $rule2 = New-AzureRmNetworkSecurityRuleConfig -Name web-rule -Description "Allow HTTP" -Access Allow -Protocol Tcp -Direction Inbound -Priority 101 -SourceAddressPrefix Internet -SourcePortRange \* -DestinationAddressPrefix 10.0.0/0/16 -DestinationPortRange 80
> $nsg = New-AzureRmNetworkSecurityGroup -ResourceGroupName TestRG -Location westus -Name "NSG-FrontEnd" -SecurityRules $rule1,$rule2
- In Azure portal, these parameters are validated

Contributor guide
Assessment
This issue has not been assessed yet.