Skip to content

Commit 682964f

Browse files
committed
Enhance functions-networking-options.md with detailed guidance on virtual network integration for various hosting plans
1 parent 1577924 commit 682964f

1 file changed

Lines changed: 94 additions & 21 deletions

File tree

articles/azure-functions/functions-networking-options.md

Lines changed: 94 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ ms.author: cachai
88
ms.custom:
99
- build-2024
1010
- sfi-image-nochange
11+
zone_pivot_groups: functions-hosting-plan
1112
---
1213

1314
# Azure Functions networking options
@@ -115,7 +116,15 @@ When you use regional virtual network integration, you can use the following Azu
115116
>
116117
> Regional virtual network integration isn't able to use port 25.
117118
118-
Considerations for the [Flex Consumption](./flex-consumption-plan.md) plan:
119+
::: zone pivot="consumption-plan"
120+
121+
> [!NOTE]
122+
> The Consumption plan doesn't support virtual network integration. To use virtual network integration, consider hosting your function app instead in a [Flex Consumption](./flex-consumption-plan.md), [Elastic Premium](./functions-premium-plan.md), or [Dedicated (App Service)](./dedicated-plan.md) plan.
123+
124+
::: zone-end
125+
::: zone pivot="flex-consumption-plan"
126+
127+
Considerations for the Flex Consumption plan:
119128

120129
* The app and the virtual network must be in the same region.
121130
* Ensure that the `Microsoft.App` Azure resource provider is enabled for your subscription by [following these instructions](../azure-resource-manager/management/resource-providers-and-types.md#register-resource-provider). This is needed for subnet delegation. The Azure portal and Azure CLI enforce this registration when you create a Flex Consumption app, since virtual network integration can be enabled at any point after your app is created.
@@ -125,6 +134,9 @@ Considerations for the [Flex Consumption](./flex-consumption-plan.md) plan:
125134
* You can't share the same subnet between a Container Apps environment and a Flex Consumption app.
126135
* The Flex Consumption plan currently doesn't support subnets with names that contain underscore (`_`) characters.
127136

137+
::: zone-end
138+
::: zone pivot="premium-plan,dedicated-plan,container-apps"
139+
128140
Considerations for the [Elastic Premium](./functions-premium-plan.md), [Dedicated (App Service)](./dedicated-plan.md), and [Container Apps](./functions-container-apps-hosting.md) plans:
129141

130142
* The feature is available for Elastic Premium and App Service Premium V2 and Premium V3. It's also available in Standard but only from newer App Service deployments. If you're on an older deployment, you can only use the feature from a Premium V2 App Service plan. If you want to make sure you can use the feature in a Standard App Service plan, create your app in a Premium V3 App Service plan. Those plans are only supported on our newest deployments. You can scale down if you desire after that.
@@ -138,6 +150,9 @@ Considerations for the [Elastic Premium](./functions-premium-plan.md), [Dedicate
138150
* You can't delete a virtual network with an integrated app. Remove the integration before you delete the virtual network.
139151
* You can't change the subscription of an app or a plan while there's an app that's using regional virtual network integration.
140152

153+
::: zone-end
154+
::: zone pivot="flex-consumption-plan,premium-plan,dedicated-plan,container-apps"
155+
141156
### Enable virtual network integration
142157

143158
1. In your function app in the [Azure portal](https://portal.azure.com), under **Settings** select **Networking**. Then under **Virtual Network Integration** select **Not configured** to add.
@@ -158,11 +173,36 @@ During the integration, your app is restarted. When integration is finished, you
158173

159174
If you prefer to only have your private traffic ([RFC1918](https://datatracker.ietf.org/doc/html/rfc1918#section-3) traffic) routed, follow the steps in this [App Service article](../app-service/overview-vnet-integration.md#application-routing).
160175

176+
::: zone-end
177+
161178
### Subnets
162179

163180
Virtual network integration depends on a dedicated subnet. When you provision a subnet, Azure reserves the first five IP addresses for internal use. The way remaining IP addresses are consumed depends on your hosting plan. Since subnet size can't be changed after assignment, use a subnet that's large enough to accommodate whatever scale your app might reach.
164181

165-
#### Elastic Premium and Dedicated Plans
182+
The following table summarizes the subnet requirements for each hosting plan:
183+
184+
| Hosting plan | VNet integration | Minimum subnet size | Recommended subnet size | Subnet delegation |
185+
|---|---|---|---|---|
186+
| Flex Consumption | Supported | /27 | /27 (single app), /26 (multiple apps) | `Microsoft.App/environments` |
187+
| Elastic Premium (Windows) | Supported | /28 | /24 | `Microsoft.Web/serverFarms` |
188+
| Elastic Premium (Linux) | Supported | /28 | /26 | `Microsoft.Web/serverFarms` |
189+
| Dedicated (App Service) | Supported | /28 | /26 or larger | `Microsoft.Web/serverFarms` |
190+
| Container Apps | Managed by environment | See [Container Apps networking](../container-apps/networking.md) | See [Container Apps networking](../container-apps/networking.md) | `Microsoft.App/environments` |
191+
| Consumption | Not supported | N/A | N/A | N/A |
192+
193+
Make sure to select your hosting plan at the top of the article for plan-specific details.
194+
195+
::: zone pivot="consumption-plan"
196+
197+
The Consumption plan doesn't support virtual network integration, so subnet sizing guidance doesn't apply to this plan. To use virtual network integration, consider the [Flex Consumption plan](./flex-consumption-plan.md), [Elastic Premium plan](./functions-premium-plan.md), or [Dedicated (App Service) plan](./dedicated-plan.md).
198+
199+
::: zone-end
200+
::: zone pivot="container-apps"
201+
202+
When running on [Azure Container Apps](./functions-container-apps-hosting.md), virtual network integration is managed through the Container Apps environment. Subnet sizing and configuration are determined by the Container Apps environment, not by the function app directly. For more information, see [Networking in Azure Container Apps environment](../container-apps/networking.md).
203+
204+
::: zone-end
205+
::: zone pivot="premium-plan,dedicated-plan"
166206

167207
In Elastic Premium and Dedicated (App Service) plans, each running instance of your function app consumes one IP address from the subnet. When you scale up or down, the required address space may temporarily double to accommodate the transition. If multiple apps share the same subnet, the total IP address usage is the sum of all instances across those apps, plus the temporary doubling during scaling events.
168208

@@ -185,37 +225,34 @@ In Elastic Premium and Dedicated (App Service) plans, each running instance of y
185225
| /25 | 123 | 61<sup>2</sup> |
186226
| /24 | 251 | 125<sup>3</sup> |
187227

188-
<sup>1</sup> Assumes that you need to scale up or down in either size or SKU at some point.
189-
190-
<sup>2</sup> Although the number of IP addresses supports 61 instances, individual apps on the Dedicated plan have a [30 instance maximum](./functions-scale.md#scale).
191-
192-
<sup>2</sup> Although the number of IP addresses supports 125 instances, individual apps on the Elastic Premium plan have a [100 instance maximum](./functions-scale.md#scale).
228+
1. Assumes that you need to scale up or down in either size or SKU at some point.
229+
2. Although the number of IP addresses supports 61 instances, individual apps on the Dedicated plan have a [30 instance maximum](./functions-scale.md#scale).
230+
3. Although the number of IP addresses supports 125 instances, individual apps on the Elastic Premium plan have a [100 instance maximum](./functions-scale.md#scale).
193231

194232
#### Additional Considerations
195233

196-
For function apps on the Elastic Premium or Dedicated plans:
197-
198234
* To avoid any issues with subnet capacity for Functions Elastic Premium plans, you should use a /24 with 256 addresses for Windows and a /26 with 64 addresses for Linux. When creating subnets in Azure portal as part of integrating with the virtual network, a minimum size of /24 and /26 is required for Windows and Linux respectively.
199235
* Each App Service plan can support up to two subnets that can be used for VNet integration. Multiple apps from a single App Service plan can join the same subnet, but apps from a different plan can't use that same subnet.
200236

201-
#### Flex Consumption Plan
202-
203-
In the Flex Consumption plan, outbound network traffic from function app instances are routed through shared gateways that are dedicated to the subnet. Each shared gateway consumes one IP address from the subnet. Regardless of how many apps are integrated with a single subnet, at most 27 shared gateways (27 IP addresses) will be used to support all instances. When selecting a subnet size, what matters is the total number of instances across all apps integrated with the subnet. When a subnet is used for too many instances or for apps performing I/O intensive workloads, network capacity issues may occur such as increased average latency and timeouts. The scale-out of apps won't be affected.
237+
::: zone-end
238+
::: zone pivot="flex-consumption-plan"
204239

205-
A /27 subnet size (27 usable IP addresses) is recommended to support a single function app, which can scale-out to a maximum of 1,000 instances.
206-
207-
If you expect your single function app to scale beyond 1,000 instances or expect the total instance count of multiple function apps to exceed 1,000 instances, then use a /26 subnet and contact the product group to request an increase to your maximum instance count.
240+
In the Flex Consumption plan, outbound network traffic from function app instances is routed through shared gateways that are dedicated to the subnet. At most 27 shared gateways (27 IP addresses) are used per subnet, regardless of how many apps are integrated. When a subnet is used for too many instances or for apps performing I/O-intensive workloads, network capacity issues such as increased latency and timeouts might occur. The scale-out of apps won't be affected.
208241

209242
> [!IMPORTANT]
210243
> Integrating Flex Consumption function apps with a subnet size less than /27 or integrating multiple apps with a /27 size subnet reduces the available outbound network capacity for them. If you plan to do so, load test your apps with production-scale workloads to ensure network capacity constraints aren't observed.
211244
212-
#### IP Consumption Scenarios
245+
#### CIDR Range Recommendations
246+
247+
| CIDR block size | Usable addresses | Max instances | Recommendation |
248+
|-----------------|------------------|---------------|----------------|
249+
| /27 | 27 | 1,000 | Recommended for a single function app |
250+
| /26 | 59 | 1,000+ | Recommended for multiple apps, or when scaling beyond 1,000 instances<sup>*</sup> |
251+
252+
<sup>*</sup> Contact the product group to request an increase to your maximum instance count.
213253

214-
| Scenario | Maximum IP Address Consumption |
215-
|----------|-----------------------------------------|
216-
| One app | Up to 27 IP addresses (/27 subnet size) |
217-
| Two apps | Up to 27 IP addresses (/27 subnet size) |
218-
| Ten apps | Up to 27 IP addresses (/27 subnet size) |
254+
::: zone-end
255+
::: zone pivot="flex-consumption-plan,premium-plan,dedicated-plan,container-apps"
219256

220257
### Network security groups
221258

@@ -250,17 +287,29 @@ The following APIs let you programmatically manage regional virtual network inte
250287
* **Azure CLI**: Use the [`az functionapp vnet-integration`](/cli/azure/functionapp/vnet-integration) commands to add, list, or remove a regional virtual network integration.
251288
* **ARM templates**: Regional virtual network integration can be enabled by using an Azure Resource Manager template. For a full example, see [this Functions quickstart template](/samples/azure/azure-quickstart-templates/function-premium-vnet-integration/).
252289

290+
::: zone-end
291+
253292
## Hybrid Connections
254293

255294
[Hybrid Connections](../azure-relay/relay-hybrid-connections-protocol.md) is a feature of Azure Relay that you can use to access application resources in other networks. It provides access from your app to an application endpoint. You can't use it to access your application. Hybrid Connections is available to functions that run on Windows in all but the Consumption plan.
256295

296+
::: zone pivot="consumption-plan,flex-consumption-plan"
297+
298+
> [!NOTE]
299+
> Hybrid Connections isn't supported on the Consumption or Flex Consumption plans. To use Hybrid Connections, consider the [Elastic Premium plan](./functions-premium-plan.md) or [Dedicated (App Service) plan](./dedicated-plan.md).
300+
301+
::: zone-end
302+
::: zone pivot="premium-plan,dedicated-plan,container-apps"
303+
257304
As used in Azure Functions, each hybrid connection correlates to a single TCP host and port combination. This means that the hybrid connection's endpoint can be on any operating system and any application as long as you're accessing a TCP listening port. The Hybrid Connections feature doesn't know or care what the application protocol is or what you're accessing. It just provides network access.
258305

259306
To learn more, see the [App Service documentation for Hybrid Connections](../app-service/app-service-hybrid-connections.md). These same configuration steps support Azure Functions.
260307

261308
>[!IMPORTANT]
262309
> Hybrid Connections is only supported when your function app runs on Windows. Linux apps aren't supported.
263310
311+
::: zone-end
312+
264313
## Connecting to Azure Services through a virtual network
265314

266315
Virtual network integration enables your function app to access resources in a virtual network. This section overviews things you should consider when attempting to connect your app to certain services.
@@ -289,6 +338,25 @@ Your workload might require your app to be triggered from an event source protec
289338

290339
Function apps running on the [Dedicated (App Service)](./dedicated-plan.md) plans don't dynamically scale based on events. Rather, [autoscale](./dedicated-plan.md#scaling) rules you define dictate scale out.
291340

341+
::: zone pivot="consumption-plan"
342+
343+
> [!NOTE]
344+
> The Consumption plan doesn't support virtual network triggers. To use virtual network triggers with dynamic scaling, consider the [Flex Consumption plan](./flex-consumption-plan.md) or [Elastic Premium plan](./functions-premium-plan.md).
345+
346+
::: zone-end
347+
::: zone pivot="container-apps"
348+
349+
> [!NOTE]
350+
> When running on Azure Container Apps, virtual network triggers are managed through the Container Apps environment networking configuration. For more information, see [Networking in Azure Container Apps environment](../container-apps/networking.md).
351+
352+
::: zone-end
353+
::: zone pivot="flex-consumption-plan"
354+
355+
The Flex Consumption plan natively supports virtual network triggers. Your function app can be triggered from event sources protected by a virtual network without requiring extra configuration for runtime scale monitoring.
356+
357+
::: zone-end
358+
::: zone pivot="premium-plan"
359+
292360
#### Elastic Premium plan with virtual network triggers
293361

294362
The [Elastic Premium plan](functions-premium-plan.md) lets you create functions that trigger services secured by a virtual network. These non-HTTP triggers are known as _virtual network triggers_.
@@ -343,12 +411,17 @@ The extensions in this table support dynamic scale monitoring of virtual network
343411
> [!IMPORTANT]
344412
> When you enable virtual network trigger monitoring, only triggers for these extensions can cause your app to scale dynamically. You can still use triggers from extensions that aren't in this table, but they won't cause scaling beyond their prewarmed instance count. For a complete list of all trigger and binding extensions, see [Triggers and bindings](./functions-triggers-bindings.md#supported-bindings).
345413
414+
::: zone-end
415+
::: zone pivot="dedicated-plan"
416+
346417
#### App Service plan and App Service Environment with virtual network triggers
347418

348419
When your function app runs in either an App Service plan or an App Service Environment, you can write functions that resources secured by a virtual network trigger. For your functions to get triggered correctly, your app must be connected to a virtual network with access to the resource defined in the trigger connection.
349420

350421
For example, assume you want to configure Azure Cosmos DB to accept traffic only from a virtual network. In this case, you must deploy your function app in an App Service plan that provides virtual network integration with that virtual network. Integration enables that Azure Cosmos DB resource to trigger a function.
351422

423+
::: zone-end
424+
352425
## Testing considerations
353426

354427
When testing functions in a function app with private endpoints, you must do your testing from within the same virtual network, such as on a virtual machine (VM) in that network. To use the **Code + Test** option in the portal from that VM, you need to add following [CORS origins](./functions-how-to-use-azure-function-app-settings.md?tabs=portal#cors) to your function app:

0 commit comments

Comments
 (0)