|
1 | 1 | ---
|
2 | 2 | title: How to configure Azure Functions with a virtual network
|
3 | 3 | description: Article that shows you how to perform certain virtual networking tasks for Azure Functions.
|
4 |
| -ms.topic: conceptual |
5 |
| -ms.date: 03/04/2022 |
| 4 | +ms.topic: how-to |
| 5 | +ms.date: 03/24/2023 |
6 | 6 | ms.custom: template-how-to
|
7 | 7 | ---
|
8 | 8 |
|
9 | 9 | # How to configure Azure Functions with a virtual network
|
10 | 10 |
|
11 |
| -This article shows you how to perform tasks related to configuring your function app to connect to and run on a virtual network. For an in-depth tutorial on how to secure your storage account, please refer to the [Connect to a Virtual Network tutorial](functions-create-vnet.md). To learn more about Azure Functions and networking, see [Azure Functions networking options](functions-networking-options.md). |
| 11 | +This article shows you how to perform tasks related to configuring your function app to connect to and run on a virtual network. For an in-depth tutorial on how to secure your storage account, refer to the [Connect to a Virtual Network tutorial](functions-create-vnet.md). To learn more about Azure Functions and networking, see [Azure Functions networking options](functions-networking-options.md). |
12 | 12 |
|
13 | 13 | ## Restrict your storage account to a virtual network
|
14 | 14 |
|
15 |
| -When you create a function app, you must create or link to a general-purpose Azure Storage account that supports Blob, Queue, and Table storage. You can replace this storage account with one that is secured with service endpoints or private endpoints. When configuring your storage account with private endpoints, public access to your storage account is not automatically disabled. In order to disable public access to your storage account, configure your storage firewall to allow access from only selected networks. |
| 15 | +When you create a function app, you must create or link to a general-purpose Azure Storage account that supports Blob, Queue, and Table storage. You can secure a new storage account behind a virtual network during account creation. At this time, you can't secure an existing storage account being used by your function app in the same way. |
16 | 16 |
|
| 17 | +> [!NOTE] |
| 18 | +> Securing your storage account is supported for all tiers in both Dedicated (App Service) and Elastic Premium plans. Consumption plans currently don't support virtual networks. |
17 | 19 |
|
| 20 | +### During function app creation |
18 | 21 |
|
19 |
| -> [!NOTE] |
20 |
| -> This feature currently works for all Windows and Linux virtual network-supported SKUs in the Dedicated (App Service) plan and for Windows Elastic Premium plans. Consumption tier isn't supported. |
| 22 | +You can create a new function app along with a new storage account secured behind a virtual network. The following links show you how to create these resources by using either the Azure portal or by using deployment templates: |
| 23 | + |
| 24 | +# [Azure portal](#tab/portal) |
| 25 | + |
| 26 | +Complete the following tutorial to create a new function app a secured storage account: [Use private endpoints to integrate Azure Functions with a virtual network](functions-create-vnet.md). |
| 27 | + |
| 28 | +# [Deployment templates](#tab/templates) |
| 29 | + |
| 30 | +Use Bicep or Azure Resource Manager (ARM) [quickstart templates](https://github.com/Azure/azure-quickstart-templates/tree/master/quickstarts/microsoft.web/function-app-storage-private-endpoints) to create secured function app and storage account resources. |
| 31 | + |
| 32 | +--- |
| 33 | + |
| 34 | +### Existing function app |
| 35 | + |
| 36 | +When you have an existing function app, you can't secure the storage account currently being used by the app. You must instead swap-out the existing storage account for a new, secured storage account. |
| 37 | + |
| 38 | +To secure the storage for an existing function app: |
| 39 | + |
| 40 | +1. Choose a function app with a storage account that doesn't have service endpoints or private endpoints enabled. |
21 | 41 |
|
22 |
| -To set up a function with a storage account restricted to a private network: |
| 42 | +1. [Enable virtual network integration](./functions-networking-options.md#enable-virtual-network-integration) for your function app. |
23 | 43 |
|
24 |
| -1. Create a function with a storage account that does not have service endpoints enabled. |
| 44 | +1. Create or configure a second storage account. This is going to be the secured storage account that your function app uses instead. |
25 | 45 |
|
26 |
| -1. Configure the function to connect to your virtual network. |
| 46 | +1. [Create a file share](../storage/files/storage-how-to-create-file-share.md#create-a-file-share) in the new storage account. |
27 | 47 |
|
28 |
| -1. Create or configure a different storage account. This will be the storage account we secure with service endpoints and connect our function. |
| 48 | +1. Secure the new storage account in one of the following ways: |
29 | 49 |
|
30 |
| -1. [Create a file share](../storage/files/storage-how-to-create-file-share.md#create-a-file-share) in the secured storage account. |
| 50 | + * [Create a private endpoint](../storage/common/storage-private-endpoints.md#creating-a-private-endpoint). When using private endpoint connections, the storage account must have private endpoints for the `file` and `blob` subresources. For Durable Functions, you must also make `queue` and `table` subresources accessible through private endpoints. |
31 | 51 |
|
32 |
| -1. Enable service endpoints or private endpoint for the storage account. |
33 |
| - * If using private endpoint connections, the storage account will need a private endpoint for the `file` and `blob` sub-resources. If using certain capabilities like Durable Functions, you will also need `queue` and `table` accessible through a private endpoint connection. |
34 |
| - * If using service endpoints, enable the subnet dedicated to your function apps for storage accounts. |
| 52 | + * [Enable a service endpoint from the virtual network](../storage/common/storage-network-security.md#grant-access-from-a-virtual-network). When using service endpoints, enable the subnet dedicated to your function apps for storage accounts on the firewall. |
35 | 53 |
|
36 |
| -1. Copy the file and blob content from the function app storage account to the secured storage account and file share. |
| 54 | +1. Copy the file and blob content from the current storage account used by the function app to the newly secured storage account and file share. |
37 | 55 |
|
38 | 56 | 1. Copy the connection string for this storage account.
|
39 | 57 |
|
|
0 commit comments