Hello Van , Welcome to MS Q&A
Why Your Configuration Fails
- Rule 1: DENY_ALL (Priority: 200)
- This rule blocks all inbound traffic within the VNet.
- It also blocks communication across peered VNets.
- However, this does NOT affect on-premises traffic because on-prem traffic comes via a GatewaySubnet, not as "Virtual Network".
- Rule 2: Allow specific network (Priority: 100)
- This rule is meant to allow on-premises traffic, but On-prem traffic does not match "Virtual Network" as a source in NSG rules.
- The source must be your on-prem network range AND should match the correct route.
- If traffic is coming via VPN Gateway, it does not hit the NSG on the subnet.
- This rule is meant to allow on-premises traffic, but On-prem traffic does not match "Virtual Network" as a source in NSG rules.
Fixing the Issue
- Modify your allow rule to apply to on-premises traffic explicitly
Example:
Priority: 100
Name: Allow_OnPrem
Port: Any
Protocol: Any
Source: 192.168.1.0/24 (replace with your actual on-prem network range)
Destination: 10.150.0.0/24
Action: Allow
- Apply NSG to the Correct Subnet
- Make sure the NSG is applied to the correct subnet of the VM you are trying to access.
- Verify UDR (User-Defined Route) Settings
- If you have a UDR (User-Defined Route) applied to the subnet, ensure that the route for the on-prem network points to the VPN Gateway.
- Check Effective Security Rules
- Use Azure Network Watcher → Effective Security Rules to see what rules are being applied.
- Check Peering Configuration (If Cross-VNet Communication is Needed)
- If traffic is coming from another VNet, ensure that VNet peering is configured to allow forwarded traffic.
Pleas check if it helps
Let us know if have further ques
Thanks
Deepashu