How to allow Direct Connect traffic in the firewall
Traffic between your network and the VNet goes through the VNet firewall, like any other traffic of the VNet, and the firewall blocks what no rule allows (see What is a firewall). To write the rules, use the target LAN-to-LAN (Peer + Routes): it stands for the addresses of a connection and the platform keeps it up to date.
What the LAN-to-LAN target covers
For one connection (a VNet bound to a Direct Connect), the target covers:
- the Remote IP of the primary peer;
- the Remote IP of the backup peer, when there is one;
- the destinations of all the static routes of the connection.
The rules that use the target follow the connection on their own: when you create or delete a static route, add, change or remove the backup peer, or change the remote IP, the rules are updated without any action from you. When you unbind the VNet, the target leaves the rules, and a rule left with no source or no destination is deleted.
In the rule form, the type LAN-to-LAN (Peer + Routes) only shows up for a VNet bound to a Direct Connect. Each connection appears in Value as the Direct Connect name followed by the primary peer, such as dc-recife (peer 172.16.1.2).
Prerequisites
- A VNet bound to a Direct Connect. See How to bind a VNet to a Direct Connect.
- The
security:firewall:managepermission.
Allow your network to reach the VMs
-
Open Security → Firewall and select the tab of the VNet. The Firewall Rules tab of the VNet page shows the same rules.
-
Click Add Rule.
-
In Create Firewall Rule, fill in the name and the service as usual, and keep the action Allow.
-
In Sources, choose LAN-to-LAN (Peer + Routes) in Type and the connection in Value.

-
In Destinations, choose the VMs that your network may reach: a subnet, a Network Tag or a VM.
-
Click Create Rule.
Allow the VMs to reach your network
Create a second rule the other way around: the VMs in Sources and the target LAN-to-LAN (Peer + Routes) in Destinations.
The target covers every route of the connection. To allow just one of your networks, use the type Custom with that network instead of the LAN-to-LAN target. In that case, the rule does not follow later changes of the connection.