Skip to content

Commit bfd11f4

Browse files
authored
Merge pull request #233242 from mattchenderson/funcstorage
adding additional storage configurations to Functions provisioning
2 parents af32a2f + df7c641 commit bfd11f4

9 files changed

+164
-28
lines changed

articles/azure-functions/create-first-function-cli-java.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@ A function app and related resources are created in Azure when you first deploy
192192
193193
The deployment packages the project files and deploys them to the new function app using [zip deployment](functions-deployment-technologies.md#zip-deploy). The code runs from the deployment package in Azure.
194194
195+
[!INCLUDE [functions-storage-access-note](../../includes/functions-storage-access-note.md)]
196+
195197
[!INCLUDE [functions-run-remote-azure-cli](../../includes/functions-run-remote-azure-cli.md)]
196198
197199
[!INCLUDE [functions-streaming-logs-cli-qs](../../includes/functions-streaming-logs-cli-qs.md)]

articles/azure-functions/functions-create-first-function-bicep.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ The following four Azure resources are created by this Bicep file:
3838
+ [**Microsoft.Web/sites**](/azure/templates/microsoft.web/sites): create a function app.
3939
+ [**microsoft.insights/components**](/azure/templates/microsoft.insights/components): create an Application Insights instance for monitoring.
4040

41+
[!INCLUDE [functions-storage-access-note](../../includes/functions-storage-access-note.md)]
42+
4143
## Deploy the Bicep file
4244

4345
1. Save the Bicep file as **main.bicep** to your local computer.

articles/azure-functions/functions-create-first-function-resource-manager.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ The following four Azure resources are created by this template:
4040
+ [**Microsoft.Web/sites**](/azure/templates/microsoft.web/sites): create a function app.
4141
+ [**microsoft.insights/components**](/azure/templates/microsoft.insights/components): create an Application Insights instance for monitoring.
4242

43+
44+
[!INCLUDE [functions-storage-access-note](../../includes/functions-storage-access-note.md)]
45+
4346
## Deploy the template
4447

4548
The following scripts are designed for and tested in [Azure Cloud Shell](../cloud-shell/overview.md). Choose **Try It** to open a Cloud Shell instance right in your browser.

articles/azure-functions/functions-deployment-technologies.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ The following table describes the available deployment methods for your Function
2020
| -- | -- | -- |
2121
| Tools-based | &bull;&nbsp;[Visual&nbsp;Studio&nbsp;Code&nbsp;publish](functions-develop-vs-code.md#publish-to-azure)<br/>&bull;&nbsp;[Visual Studio publish](functions-develop-vs.md#publish-to-azure)<br/>&bull;&nbsp;[Core Tools publish](functions-run-local.md#publish) | Deployments during development and other ad hoc deployments. Deployments are managed locally by the tooling. |
2222
| App Service-managed| &bull;&nbsp;[Deployment&nbsp;Center&nbsp;(CI/CD)](functions-continuous-deployment.md)<br/>&bull;&nbsp;[Container&nbsp;deployments](functions-create-function-linux-custom-image.md#enable-continuous-deployment-to-azure) | Continuous deployment (CI/CD) from source control or from a container registry. Deployments are managed by the App Service platform (Kudu).|
23-
| External pipelines|&bull;&nbsp;[Azure Pipelines](functions-how-to-azure-devops.md)<br/>&bull;&nbsp;[GitHub Actions](functions-how-to-github-actions.md) | Production and DevOps pipelines that include additional validation, testing, and other actions be run as part of an automated deployment. Deployments are managed by the pipeline. |
23+
| External pipelines|&bull;&nbsp;[Azure Pipelines](functions-how-to-azure-devops.md)<br/>&bull;&nbsp;[GitHub Actions](functions-how-to-github-actions.md) | Production and Azure pipelines that include additional validation, testing, and other actions be run as part of an automated deployment. Deployments are managed by the pipeline. |
2424

2525
While specific Functions deployments use the best technology based on their context, most deployment methods are based on [zip deployment](#zip-deploy).
2626

@@ -95,6 +95,12 @@ Linux function apps running in the Consumption plan don't have an SCM/Kudu site,
9595

9696
Function apps running on Linux in the [Dedicated (App Service) plan](dedicated-plan.md) and the [Premium plan](functions-premium-plan.md) also have a limited SCM/Kudu site.
9797

98+
### App content storage
99+
100+
Several deployment methods store the deployed or built application payload on the storage account associated with the function app. The Azure Files content share is generally used if configured, but some methods will instead store the payload in the blob store associated with the `AzureWebJobsStorage` connection. See the details in the "Where app content is stored" paragraphs of each deployment technology covered in the next section.
101+
102+
[!INCLUDE [functions-storage-access-note](../../includes/functions-storage-access-note.md)]
103+
98104
## Deployment technology details
99105

100106
The following deployment methods are available in Azure Functions.
@@ -109,6 +115,8 @@ You can use an external package URL to reference a remote package (.zip) file th
109115
110116
>__When to use it:__ External package URL is the only supported deployment method for Azure Functions running on Linux in the Consumption plan, if the user doesn't want a [remote build](#remote-build) to occur. When you update the package file that a function app references, you must [manually sync triggers](#trigger-syncing) to tell Azure that your application has changed. When you change the contents of the package file and not the URL itself, you must also restart your function app manually.
111117
118+
>__Where app content is stored:__ App content is stored at the URL specified. This could be on Azure Blobs, possibly in the storage account specified by the `AzureWebJobsStorage` connection. Some client tools may default to deploying to a blob in this account. For example, for Linux Consumption apps, the Azure CLI will attempt to deploy through a package stored in a blob on the account specified by `AzureWebJobsStorage`.
119+
112120
### Zip deploy
113121

114122
Use zip deploy to push a .zip file that contains your function app to Azure. Optionally, you can set your app to start [running from package](run-functions-from-deployment-package.md), or specify that a [remote build](#remote-build) occurs.
@@ -119,6 +127,8 @@ Use zip deploy to push a .zip file that contains your function app to Azure. Opt
119127
120128
>__When to use it:__ Zip deploy is the recommended deployment technology for Azure Functions.
121129
130+
>__Where app content is stored:__ App content from a zip deploy by default is stored on the file system, which may be backed by Azure Files from the storage account specified when the function app was created. In Linux Consumption, the app content instead is persisted on a blob in the storage account specified by the `AzureWebJobsStorage` connection.
131+
122132
### Docker container
123133

124134
You can deploy a Linux container image that contains your function app.
@@ -132,6 +142,8 @@ You can deploy a Linux container image that contains your function app.
132142
133143
>__When to use it:__ Use the Docker container option when you need more control over the Linux environment where your function app runs. This deployment mechanism is available only for Functions running on Linux.
134144
145+
>__Where app content is stored:__ App content is stored in the specified container registry as a part of the image.
146+
135147
### Web Deploy (MSDeploy)
136148

137149
Web Deploy packages and deploys your Windows applications to any IIS server, including your function apps running on Windows in Azure.
@@ -142,6 +154,8 @@ Web Deploy packages and deploys your Windows applications to any IIS server, inc
142154
143155
>__When to use it:__ Web Deploy is supported and has no issues, but the preferred mechanism is [zip deploy with Run From Package enabled](#zip-deploy). To learn more, see the [Visual Studio development guide](functions-develop-vs.md#publish-to-azure).
144156
157+
>__Where app content is stored:__ App content is stored on the file system, which may be backed by Azure Files from the storage account specified when the function app was created.
158+
145159
### Source control
146160

147161
Use source control to connect your function app to a Git repository. An update to code in that repository triggers deployment. For more information, see the [Kudu Wiki](https://github.com/projectkudu/kudu/wiki/VSTS-vs-Kudu-deployments).
@@ -150,6 +164,8 @@ Use source control to connect your function app to a Git repository. An update t
150164
151165
>__When to use it:__ Using source control is the best practice for teams that collaborate on their function apps. Source control is a good deployment option that enables more sophisticated deployment pipelines.
152166
167+
>__Where app content is stored:__ The app content is in the source control system, but a locally cloned and built app content from is stored on the app file system, which may be backed by Azure Files from the storage account specified when the function app was created.
168+
153169
### Local Git
154170

155171
You can use local Git to push code from your local machine to Azure Functions by using Git.
@@ -158,6 +174,8 @@ You can use local Git to push code from your local machine to Azure Functions by
158174
159175
>__When to use it:__ In general, we recommend that you use a different deployment method. When you publish from local Git, you must [manually sync triggers](#trigger-syncing).
160176
177+
>__Where app content is stored:__ App content is stored on the file system, which may be backed by Azure Files from the storage account specified when the function app was created.
178+
161179
### Cloud sync
162180

163181
Use cloud sync to sync your content from Dropbox and OneDrive to Azure Functions.
@@ -166,6 +184,8 @@ Use cloud sync to sync your content from Dropbox and OneDrive to Azure Functions
166184
167185
>__When to use it:__ In general, we recommend other deployment methods. When you publish by using cloud sync, you must [manually sync triggers](#trigger-syncing).
168186
187+
>__Where app content is stored:__ The app content is in the cloud store, but a local copy is stored on the app file system, which may be backed by Azure Files from the storage account specified when the function app was created.
188+
169189
### FTP
170190

171191
You can use FTP to directly transfer files to Azure Functions.
@@ -174,6 +194,8 @@ You can use FTP to directly transfer files to Azure Functions.
174194
175195
>__When to use it:__ In general, we recommend other deployment methods. When you publish by using FTP, you must [manually sync triggers](#trigger-syncing).
176196
197+
>__Where app content is stored:__ App content is stored on the file system, which may be backed by Azure Files from the storage account specified when the function app was created.
198+
177199
### Portal editing
178200

179201
In the portal-based editor, you can directly edit the files that are in your function app (essentially deploying every time you save your changes).
@@ -186,6 +208,8 @@ In the portal-based editor, you can directly edit the files that are in your fun
186208
>+ [Azure Functions Core Tools (command line)](functions-run-local.md)
187209
>+ [Visual Studio](functions-create-your-first-function-visual-studio.md)
188210
211+
>__Where app content is stored:__ App content is stored on the file system, which may be backed by Azure Files from the storage account specified when the function app was created.
212+
189213
The following table shows the operating systems and languages that support portal editing:
190214

191215
| Language | Windows Consumption | Windows Premium | Windows Dedicated | Linux Consumption | Linux Premium | Linux Dedicated |

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

Lines changed: 80 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,22 @@ An Azure Functions deployment typically consists of these resources:
5252

5353
A storage account is required for a function app. You need a general purpose account that supports blobs, tables, queues, and files. For more information, see [Azure Functions storage account requirements](storage-considerations.md#storage-account-requirements).
5454

55+
[!INCLUDE [functions-storage-access-note](../../includes/functions-storage-access-note.md)]
56+
5557
# [Bicep](#tab/bicep)
5658

5759
```bicep
58-
resource storageAccountName 'Microsoft.Storage/storageAccounts@2021-09-01' = {
60+
resource storageAccountName 'Microsoft.Storage/storageAccounts@2022-05-01' = {
5961
name: storageAccountName
6062
location: location
6163
kind: 'StorageV2'
6264
sku: {
6365
name: storageAccountType
6466
}
67+
properties: {
68+
supportsHttpsTrafficOnly: true
69+
defaultToOAuthAuthentication: true
70+
}
6571
}
6672
```
6773

@@ -71,24 +77,24 @@ resource storageAccountName 'Microsoft.Storage/storageAccounts@2021-09-01' = {
7177
"resources": [
7278
{
7379
"type": "Microsoft.Storage/storageAccounts",
74-
"apiVersion": "2021-09-01",
80+
"apiVersion": "2022-05-01",
7581
"name": "[parameters('storageAccountName')]",
7682
"location": "[parameters('location')]",
7783
"kind": "StorageV2",
7884
"sku": {
7985
"name": "[parameters('storageAccountType')]"
86+
},
87+
"properties": {
88+
"supportsHttpsTrafficOnly": true,
89+
"defaultToOAuthAuthentication": true
8090
}
8191
}
8292
]
8393
```
8494

8595
---
8696

87-
You must also specify the `AzureWebJobsStorage` property as an app setting in the site configuration. If the function app doesn't use Application Insights for monitoring, it should also specify `AzureWebJobsDashboard` as an app setting.
88-
89-
The Azure Functions runtime uses the `AzureWebJobsStorage` connection string to create internal queues. When Application Insights isn't enabled, the runtime uses the `AzureWebJobsDashboard` connection string to log to Azure Table storage and power the **Monitor** tab in the portal.
90-
91-
These properties are specified in the `appSettings` collection in the `siteConfig` object:
97+
You must also specify the `AzureWebJobsStorage` connection in the site configuration. This can be set in the `appSettings` collection in the `siteConfig` object:
9298

9399
# [Bicep](#tab/bicep)
94100

@@ -100,10 +106,6 @@ resource functionApp 'Microsoft.Web/sites@2022-03-01' = {
100106
siteConfig: {
101107
...
102108
appSettings: [
103-
{
104-
name: 'AzureWebJobsDashboard'
105-
value: 'DefaultEndpointsProtocol=https;AccountName=${storageAccountName};AccountKey=${storageAccount.listKeys().keys[0].value}'
106-
}
107109
{
108110
name: 'AzureWebJobsStorage'
109111
value: 'DefaultEndpointsProtocol=https;AccountName=${storageAccountName};AccountKey=${storageAccount.listKeys().keys[0].value}'
@@ -127,10 +129,6 @@ resource functionApp 'Microsoft.Web/sites@2022-03-01' = {
127129
"siteConfig": {
128130
...
129131
"appSettings": [
130-
{
131-
"name": "AzureWebJobsDashboard",
132-
"value": "[format('DefaultEndpointsProtocol=https;AccountName={0};AccountKey={1}', parameters('storageAccountName'), listKeys(resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName')), '2021-09-01').keys[0].value)]"
133-
},
134132
{
135133
"name": "AzureWebJobsStorage",
136134
"value": "[format('DefaultEndpointsProtocol=https;AccountName={0};AccountKey={1}', parameters('storageAccountName'), listKeys(resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName')), '2021-09-01').keys[0].value)]"
@@ -145,6 +143,73 @@ resource functionApp 'Microsoft.Web/sites@2022-03-01' = {
145143

146144
---
147145

146+
In some hosting plan options, function apps should also have an Azure Files content share, and they will need additional app settings referencing this storage account. These are covered later in this article as a part of the hosting plan options to which this applies.
147+
148+
#### Storage logs
149+
150+
Because the storage account is used for important function app data, you may want to monitor for modification of that content. To do this, you need to configure Azure Monitor resource logs for Azure Storage. In the following example, a Log Analytics workspace named `myLogAnalytics` is used as the destination for these logs. This same workspace can be used for the Application Insights resource defined later.
151+
152+
# [Bicep](#tab/bicep)
153+
154+
```bicep
155+
resource blobService 'Microsoft.Storage/storageAccounts/blobServices@2021-09-01' existing = {
156+
name:'default'
157+
parent:storageAccountName
158+
}
159+
160+
resource storageDataPlaneLogs 'Microsoft.Insights/diagnosticSettings@2021-05-01-preview' = {
161+
name: '${storageAccountName}-logs'
162+
scope: blobService
163+
properties: {
164+
workspaceId: myLogAnalytics.id
165+
logs: [
166+
{
167+
category: 'StorageWrite'
168+
enabled: true
169+
}
170+
]
171+
metrics: [
172+
{
173+
category: 'Transaction'
174+
enabled: true
175+
}
176+
]
177+
}
178+
}
179+
```
180+
181+
# [JSON](#tab/json)
182+
183+
```json
184+
"resources": [
185+
{
186+
"type": "Microsoft.Insights/diagnosticSettings",
187+
"apiVersion": "2021-05-01-preview",
188+
"scope": "[format('Microsoft.Storage/storageAccounts/{0}/blobServices/default', parameters('storageAccountName'))]",
189+
"name": "[parameters('storageDataPlaneLogsName')]",
190+
"properties": {
191+
"workspaceId": "[resourceId('Microsoft.OperationalInsights/workspaces', parameters('myLogAnalytics'))]",
192+
"logs": [
193+
{
194+
"category": "StorageWrite",
195+
"enabled": true
196+
}
197+
],
198+
"metrics": [
199+
{
200+
"category": "Transaction",
201+
"enabled": true
202+
}
203+
]
204+
}
205+
}
206+
]
207+
```
208+
209+
---
210+
211+
See [Monitoring Azure Storage](../storage/blobs/monitor-blob-storage.md) for instructions on how to work with these logs.
212+
148213
### Application Insights
149214

150215
Application Insights is recommended for monitoring your function apps. The Application Insights resource is defined with the type `Microsoft.Insights/components` and the kind **web**:

0 commit comments

Comments
 (0)