Skip to content

Commit 26a4dec

Browse files
Merge pull request #264968 from ggailey777/sam
[Functions] im-samz updates to the network config article
2 parents eaee23c + 5260108 commit 26a4dec

File tree

2 files changed

+49
-25
lines changed

2 files changed

+49
-25
lines changed

articles/azure-functions/configure-networking-how-to.md

Lines changed: 48 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,94 @@
11
---
2-
title: How to configure Azure Functions with a virtual network
3-
description: Article that shows you how to perform certain virtual networking tasks for Azure Functions.
2+
title: How to use a secured storage account with Azure Functions
3+
description: Article that shows you how to use a secured storage account in a virtual network as the default storage account for a function app in Azure Functions.
44
ms.topic: how-to
5-
ms.date: 06/23/2023
5+
ms.date: 01/31/2024
66
ms.custom: template-how-to
77
---
88

9-
# How to configure Azure Functions with a virtual network
9+
# How to use a secured storage account with Azure Functions
1010

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).
11+
This article shows you how to connect your function app to a secured storage account. For an in-depth tutorial on how to create your function app with inbound and outbound access restrictions, refer to the [Integrate with a virtual network](functions-create-vnet.md) tutorial. To learn more about Azure Functions and networking, see [Azure Functions networking options](functions-networking-options.md).
1212

1313
## Restrict your storage account to a virtual network
1414

15-
When you create a function app, you either create a new storage account or link to an existing storage account. During function app creation, you can secure a new storage account behind a virtual network and integrate the function app with this network. At this time, you can't secure an existing storage account being used by your function app in the same way.
15+
When you create a function app, you either create a new storage account or link to an existing one. Currently, only [ARM template and Bicep deployments](functions-infrastructure-as-code.md#secured-deployments) support function app creation with an existing secured storage account.
1616

1717
> [!NOTE]
1818
> 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.
1919
2020
For a list of all restrictions on storage accounts, see [Storage account requirements](storage-considerations.md#storage-account-requirements).
2121

22-
### During function app creation
22+
## Secure storage during function app creation
2323

24-
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:
24+
You can create a function app along with a new storage account secured behind a virtual network that is accessible via private endpoints. The following links show you how to create these resources by using either the Azure portal or by using deployment templates:
2525

26-
# [Azure portal](#tab/portal)
26+
### [Azure portal](#tab/portal)
2727

2828
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).
2929

30-
# [Deployment templates](#tab/templates)
30+
### [Deployment templates](#tab/templates)
3131

3232
Use Bicep files or Azure Resource Manager (ARM) templates to create a secured function app and storage account resources. When you create a secured storage account in an automated deployment, you must also specifically set the `WEBSITE_CONTENTSHARE` setting and create the file share as part of your deployment. For more information, including links to example deployments, see [Secured deployments](functions-infrastructure-as-code.md#secured-deployments).
3333

3434
---
3535

36-
### Existing function app
36+
## Secure storage for an existing function app
3737

38-
When you have an existing function app, you can't directly 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.
38+
When you have an existing function app, you can't directly 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.
3939

40-
To secure the storage for an existing function app:
40+
### 1. Enable virtual network integration
41+
42+
As a prerequisite, you need to enable virtual network integration for your function app.
4143

4244
1. Choose a function app with a storage account that doesn't have service endpoints or private endpoints enabled.
4345

4446
1. [Enable virtual network integration](./functions-networking-options.md#enable-virtual-network-integration) for your function app.
4547

46-
1. Create or configure a second storage account. This is going to be the secured storage account that your function app uses instead.
48+
### 2. Create a secured storage account
49+
50+
Set up a secured storage account for your function app:
51+
52+
1. [Create a second storage account](../storage/common/storage-account-create.md). This is going to be the secured storage account that your function app will use instead. You can also use an existing storage account not already being used by Functions.
53+
54+
1. Copy the connection string for this storage account. You need this string for later.
4755

48-
1. [Create a file share](../storage/files/storage-how-to-create-file-share.md#create-a-file-share) in the new storage account.
56+
1. [Create a file share](../storage/files/storage-how-to-create-file-share.md#create-a-file-share) in the new storage account. Try to use the same name as the file share in the existing storage account. Otherwise, you'll need to copy the name of the new file share to configure an app setting later.
4957

5058
1. Secure the new storage account in one of the following ways:
5159

52-
* [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.
60+
* [Create a private endpoint](../storage/common/storage-private-endpoints.md#creating-a-private-endpoint). When you set up private endpoint connections, create private endpoints for the `file` and `blob` subresources. For Durable Functions, you must also make `queue` and `table` subresources accessible through private endpoints. If you're using a custom or on-premises DNS server, make sure you [configure your DNS server](../storage/common/storage-private-endpoints.md#dns-changes-for-private-endpoints) to resolve to the new private endpoints.
61+
62+
* [Restrict traffic to specific subnets](../storage/common/storage-network-security.md#grant-access-from-a-virtual-network). Ensure that one of the allowed subnets is the one your function app is network integrated with. Double check that the subnet has a service endpoint to Microsoft.Storage.
63+
64+
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. [AzCopy](../storage/common/storage-use-azcopy-blobs-copy.md) and [Azure Storage Explorer](https://techcommunity.microsoft.com/t5/azure-developer-community-blog/azure-tips-and-tricks-how-to-move-azure-storage-blobs-between/ba-p/3545304) are common methods. If you use Azure Storage Explorer, you may need to allow your client IP address into your storage account's firewall.
65+
66+
Now you're ready to configure your function app to communicate with the newly secured storage account.
67+
68+
### 3. Enable application and configuration routing
69+
70+
You should now route your function app's traffic to go through the virtual network.
71+
72+
1. Enable [application routing](../app-service/overview-vnet-integration.md#application-routing) to route your app's traffic into the virtual network.
73+
74+
* Navigate to the **Networking** tab of your function app. Under **Outbound traffic configuration**, select the subnet associated with your virtual network integration.
75+
76+
* In the new page, check the box for **Outbound internet traffic** under **Application routing**.
77+
78+
1. Enable [content share routing](../app-service/overview-vnet-integration.md#content-share) to have your function app communicate with your new storage account through its virtual network.
5379

54-
* [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.
80+
* In the same page, check the box for **Content storage** under **Configuration routing**.
5581

56-
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.
82+
### 4. Update application settings
5783

58-
1. Copy the connection string for this storage account.
84+
Finally, you need to update your application settings to point at the new secure storage account.
5985

60-
1. Update the **Application Settings** under **Configuration** for the function app to the following:
86+
1. Update the **Application Settings** under the **Configuration** tab of your function app to the following:
6187

6288
| Setting name | Value | Comment |
6389
|----|----|----|
64-
| `AzureWebJobsStorage`| Storage connection string | This is the connection string for a secured storage account. |
65-
| `WEBSITE_CONTENTAZUREFILECONNECTIONSTRING` | Storage connection string | This is the connection string for a secured storage account. This setting is required for Consumption and Elastic Premium plan apps on both Windows and Linux. It's not required for Dedicated plan apps, which aren't dynamically scaled by Functions. |
66-
| `WEBSITE_CONTENTSHARE` | File share | The name of the file share created in the secured storage account where the project deployment files reside. This setting is required for Consumption and Elastic Premium plan apps on both Windows and Linux. It's not required for Dedicated plan apps, which aren't dynamically scaled by Functions. |
67-
| `WEBSITE_CONTENTOVERVNET` | 1 | A value of 1 enables your function app to scale when you have your storage account restricted to a virtual network. You should enable this setting when restricting your storage account to a virtual network. |
90+
| [`AzureWebJobsStorage`](./functions-app-settings.md#azurewebjobsstorage)<br>[`WEBSITE_CONTENTAZUREFILECONNECTIONSTRING`](./functions-app-settings.md#website_contentazurefileconnectionstring) | Storage connection string | Both settings contain the connection string for the new secured storage account, which you saved earlier. |
91+
| [`WEBSITE_CONTENTSHARE`](./functions-app-settings.md#website_contentshare) | File share | The name of the file share created in the secured storage account where the project deployment files reside. |
6892

6993
1. Select **Save** to save the application settings. Changing app settings causes the app to restart.
7094

articles/azure-functions/functions-infrastructure-as-code.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1665,7 +1665,7 @@ Keep the following considerations in mind when working with slot deployments:
16651665
:::zone pivot="premium-plan,dedicated-plan"
16661666
## Secured deployments
16671667

1668-
You can create your function app in a deployment where one or more of the resources have been secured by integrating with virtual networks. Virtual network integration for your function app is defined by a `Microsoft.Web/sites/networkConfig` resource. This integration depends on both the referenced function app and virtual network resources. You function app might also depend on other private networking resources, such as private endpoints and routes. For more information, see [Azure Functions networking options](functions-networking-options.md).
1668+
You can create your function app in a deployment where one or more of the resources have been secured by integrating with virtual networks. Virtual network integration for your function app is defined by a `Microsoft.Web/sites/networkConfig` resource. This integration depends on both the referenced function app and virtual network resources. Your function app might also depend on other private networking resources, such as private endpoints and routes. For more information, see [Azure Functions networking options](functions-networking-options.md).
16691669

16701670
When creating a deployment that uses a secured storage account, you must both explicitly set the `WEBSITE_CONTENTSHARE` setting and create the file share resource named in this setting. Make sure you create a `Microsoft.Storage/storageAccounts/fileServices/shares` resource using the value of `WEBSITE_CONTENTSHARE`, as shown in this example ([ARM template](https://github.com/Azure-Samples/function-app-arm-templates/blob/main/function-app-private-endpoints-storage-private-endpoints/azuredeploy.json#L467)|[Bicep file](https://github.com/Azure-Samples/function-app-arm-templates/blob/main/function-app-private-endpoints-storage-private-endpoints/main.bicep#L351)).
16711671

0 commit comments

Comments
 (0)