Manage network policies for private endpoints
By default, network policies are disabled for a subnet in a virtual network. To utilize network policies like User-Defined Routes and Network Security Groups support, network policy support must be enabled for the subnet. This setting is only applicable to private endpoints within the subnet. This setting affects all private endpoints within the subnet. For other resources in the subnet, access is controlled based on security rules in the network security group.
Network policies can be enabled either for Network Security Groups only, for User-Defined Routes only, or for both.
If you enable network security policies for User-Defined Routes, the /32 routes that are generated by the private endpoint and propagated to all the subnets in its own VNet and directly peered VNets will be invalidated if you have User-Defined Routing, which is useful if you want all traffic (including traffic addressed to the private endpoint) to go through a firewall, since otherwise the /32 route would bypass any other route.
Note
Unless you configure a UDR, the Private Endpoint Route of /32 will remain active. And for the UDR to work on all private endpoints within the subnet, you need to enable PrivateEndpointNetworkPolicies.
You can use the following to enable or disable the setting:
- Azure portal
- Azure PowerShell
- Azure CLI
- Azure Resource Manager templates
The following examples describe how to enable and disable PrivateEndpointNetworkPolicies for a virtual network named myVNet with a default subnet of 10.1.0.0/24 hosted in a resource group named myResourceGroup.
Enable network policy
Sign-in to the Azure portal.
In the search box at the top of the portal, enter Virtual network. Select Virtual networks.
Select myVNet.
In settings of myVNet, select Subnets.
Select the default subnet.
In the properties for the default subnet, enable the checkboxes for "Network Security Groups", "Route tables" or both in NETWORK POLICY FOR PRIVATE ENDPOINTS.
Select Save.
Disable network policy
Sign-in to the Azure portal.
In the search box at the top of the portal, enter Virtual network. Select Virtual networks.
Select myVNet.
In settings of myVNet, select Subnets.
Select the default subnet.
In the properties for the default subnet, select Disabled in NETWORK POLICY FOR PRIVATE ENDPOINTS.
Select Save.
Important
There are limitations to private endpoints in relation to the network policy feature and Network Security Groups and User Defined Routes. For more information, see Limitations.
Next steps
- Learn more about Azure private endpoint
Feedback
Submit and view feedback for