Azure Function App networking
The "Vnet integration" feature of Function Apps concerns outgoing traffic. Different deployment types have different networking requirements. Specifically, Flex Consumption uses a different networking model from Premium and Dedicated Function App plans.
Use case: I'm planning the networking for hosting a series of Enterprise MCP servers, of which some need to connect to private company resources which only allow traffic from spoke VNets (in a hub & spoke architecture). The outgoing traffic can use an integrated subnet within a networking spoke. This leads to the practical question: how big must this subnet be in order to support existing MCP servers and be sufficiently future proof, anticipating more servers. An important factor in this is that Azure Function apps scale out and that traditionally each app instance claimed a single IP address. The relatively new Flex Consumption plan is particularly interesting in this regard, read on...
Note: Because the subnet integration is on outgoing traffic only, Azure Functions have the handy feature (handy in practical terms, not security terms) that they can accept traffic from the public internet at the front (with networking restrictions), while being able to integrate with private networking at the "back" if the integrated subnet is let's say in an Enterprise Hub & Spoke. Strictly speaking, I guess this is what they call a backdoor?! Anyways...
Flex consumption vs. other plans
In Flex Consumption, instances do not each consume a dedicated IP address from the integrated subnet. Instead, all apps connected to the subnet share a pool of platform-managed network gateways. These gateways use addresses from the subnet and dynamically support apps as they scale.
This "IP-multiplexing" model differs fundamentally from Premium plans, where each instance consumes one IP address from the subnet.
Premium and Dedicated plans use a more direct allocation model: each instance consumes one IP address from the integrated subnet. They also use the Microsoft.Web/serverFarms subnet delegation.
| Feature | Flex Consumption | Premium and Dedicated |
|---|---|---|
| IP allocation | Shared pool of platform-managed network gateways | One subnet IP address per instance |
| Subnet delegation | Microsoft.App/environments |
Microsoft.Web/serverFarms |
| Scaling impact | IP usage is multiplexed across instances and apps | IP usage grows more directly with the number of instances |
| Recommended planning | Reserve capacity equivalent to 40 IP addresses per app as a guideline | Size the subnet based on the number of instances and apps that require addresses |
Because Flex Consumption multiplexes IP addresses, a /27 subnet can support a single app with up to 1,000 instances.
For multiple apps or high-scale workloads, a /26 subnet is recommended to provide sufficient gateway capacity.
Flex Consumption subnet sizing and networking requirements
Microsoft recommends reserving 40 IP addresses per app to ensure sufficient capacity for the platform gateway pool and other infrastructure components. It is not an enforced limit, and actual consumption is typically lower. The platform dynamically allocates addresses from the shared gateway pool as the connected apps scale out.
Size matters
| Scenario | Recommended CIDR | Usable IPs | Notes |
|---|---|---|---|
| Single Flex Consumption app | /27 |
27 | Minimum supported subnet size for a single app |
| Multiple Flex Consumption apps in one subnet | /26 |
59 | Recommended for multiple apps and high-scale workloads, including workloads with 1,000+ instances |
NOTE: Azure always reserves 5 IP addresses per subnet.
The CIDR /27 translates to 32 IPs, of which 32-5=27 are usable (which, as a nice mnemonic, happens to coincide with the CIDR).
NOTE: If many apps share a subnet and scale out while generating significant outbound traffic, network throughput may become the limiting factor before the subnet runs out of IP addresses.
Subnet delegation
- Delegate the subnet to
Microsoft.App/environments. - This differs from Premium and Dedicated plans, which use
Microsoft.Web/serverFarms. - Register the
Microsoft.Appresource provider in your subscription.
Subnet usage restrictions
The subnet:
- Must not already be used for private endpoints or service endpoints.
- Must not be delegated to another hosting plan or service.
- Cannot be shared between an Azure Container Apps environment and a Flex Consumption app.
- Must be located in the same region as the app.
Sharing a subnet
You can use the same subnet for multiple apps running on a Flex Consumption plan. However, networking resources are shared across all apps on the subnet. As a result, one function app can affect the performance of others.
When placing multiple apps in a small subnet, consider their combined resource and traffic requirements.