Azure / Azure/azure-powershell

Input validation in New/Set-AzureRmNetworkSecurityRuleConfig

Open
#2,814 3 comments 0 reactions 1 assignee Assigned to @chandrasekarsrinivasan View on GitHub
act-quality-productivity-squad Network - Virtual Network Service Attention
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
![nsg](https://cloud.githubusercontent.com/assets/16984569/17840998/954adc7c-684e-11e6-85ca-dd261e444081.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.