You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-functions/functions-networking-options.md
+94-21Lines changed: 94 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,7 @@ ms.author: cachai
8
8
ms.custom:
9
9
- build-2024
10
10
- sfi-image-nochange
11
+
zone_pivot_groups: functions-hosting-plan
11
12
---
12
13
13
14
# Azure Functions networking options
@@ -115,7 +116,15 @@ When you use regional virtual network integration, you can use the following Azu
115
116
>
116
117
> Regional virtual network integration isn't able to use port 25.
117
118
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:
119
128
120
129
* The app and the virtual network must be in the same region.
121
130
* 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:
125
134
* You can't share the same subnet between a Container Apps environment and a Flex Consumption app.
126
135
* The Flex Consumption plan currently doesn't support subnets with names that contain underscore (`_`) characters.
127
136
137
+
::: zone-end
138
+
::: zone pivot="premium-plan,dedicated-plan,container-apps"
139
+
128
140
Considerations for the [Elastic Premium](./functions-premium-plan.md), [Dedicated (App Service)](./dedicated-plan.md), and [Container Apps](./functions-container-apps-hosting.md) plans:
129
141
130
142
* 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
138
150
* You can't delete a virtual network with an integrated app. Remove the integration before you delete the virtual network.
139
151
* You can't change the subscription of an app or a plan while there's an app that's using regional virtual network integration.
140
152
153
+
::: zone-end
154
+
::: zone pivot="flex-consumption-plan,premium-plan,dedicated-plan,container-apps"
155
+
141
156
### Enable virtual network integration
142
157
143
158
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
158
173
159
174
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).
160
175
176
+
::: zone-end
177
+
161
178
### Subnets
162
179
163
180
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.
164
181
165
-
#### Elastic Premium and Dedicated Plans
182
+
The following table summarizes the subnet requirements for each hosting plan:
| 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"
166
206
167
207
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.
168
208
@@ -185,37 +225,34 @@ In Elastic Premium and Dedicated (App Service) plans, each running instance of y
185
225
| /25 | 123 | 61<sup>2</sup> |
186
226
| /24 | 251 | 125<sup>3</sup> |
187
227
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).
193
231
194
232
#### Additional Considerations
195
233
196
-
For function apps on the Elastic Premium or Dedicated plans:
197
-
198
234
* 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.
199
235
* 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.
200
236
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"
204
239
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.
208
241
209
242
> [!IMPORTANT]
210
243
> 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.
| 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"
219
256
220
257
### Network security groups
221
258
@@ -250,17 +287,29 @@ The following APIs let you programmatically manage regional virtual network inte
250
287
***Azure CLI**: Use the [`az functionapp vnet-integration`](/cli/azure/functionapp/vnet-integration) commands to add, list, or remove a regional virtual network integration.
251
288
***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/).
252
289
290
+
::: zone-end
291
+
253
292
## Hybrid Connections
254
293
255
294
[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.
256
295
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
+
257
304
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.
258
305
259
306
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.
260
307
261
308
>[!IMPORTANT]
262
309
> Hybrid Connections is only supported when your function app runs on Windows. Linux apps aren't supported.
263
310
311
+
::: zone-end
312
+
264
313
## Connecting to Azure Services through a virtual network
265
314
266
315
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
289
338
290
339
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.
291
340
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
+
292
360
#### Elastic Premium plan with virtual network triggers
293
361
294
362
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
343
411
> [!IMPORTANT]
344
412
> 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).
345
413
414
+
::: zone-end
415
+
::: zone pivot="dedicated-plan"
416
+
346
417
#### App Service plan and App Service Environment with virtual network triggers
347
418
348
419
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.
349
420
350
421
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.
351
422
423
+
::: zone-end
424
+
352
425
## Testing considerations
353
426
354
427
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