Skip to content

Commit 590fbed

Browse files
Merge pull request #227015 from ggailey777/arm-fixup
[Functions] Arm wiki migration and other updates
2 parents 6f56306 + 5ab6a5b commit 590fbed

12 files changed

+1133
-1088
lines changed

.openpublishing.publish.config.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,12 @@
230230
"branch": "master",
231231
"branch_mapping": {}
232232
},
233+
{
234+
"path_to_root": "function-app-arm-templates",
235+
"url": "https://github.com/Azure-Samples/function-app-arm-templates",
236+
"branch": "main",
237+
"branch_mapping": {}
238+
},
233239
{
234240
"path_to_root": "functions-azure-product",
235241
"url": "https://github.com/Azure/Azure-Functions",

articles/azure-functions/TOC.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,7 @@
512512
href: run-functions-from-deployment-package.md
513513
- name: Automate resource deployment
514514
href: functions-infrastructure-as-code.md
515+
displayName: bicep, ARM template
515516
- name: Deploy using the Jenkins plugin
516517
href: /azure/developer/jenkins/deploy-to-azure-functions?toc=/azure/azure-functions/toc.json
517518
- name: Configure

articles/azure-functions/deployment-zip-push.md

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Zip deployment is also an easy way to run your functions from the deployment pac
1515

1616
Azure Functions has the full range of continuous deployment and integration options that are provided by Azure App Service. For more information, see [Continuous deployment for Azure Functions](functions-continuous-deployment.md).
1717

18-
To speed up development, you may find it easier to deploy your function app project files directly from a .zip file. The .zip deployment API takes the contents of a .zip file and extracts the contents into the `wwwroot` folder of your function app. This .zip file deployment uses the same Kudu service that powers continuous integration-based deployments, including:
18+
To speed up development, you might find it easier to deploy your function app project files directly from a .zip file. The .zip deployment API takes the contents of a .zip file and extracts the contents into the `wwwroot` folder of your function app. This .zip file deployment uses the same Kudu service that powers continuous integration-based deployments, including:
1919

2020
+ Deletion of files that were left over from earlier deployments.
2121
+ Deployment customization, including running deployment scripts.
@@ -54,6 +54,61 @@ When you're using Azure CLI on your local computer, `<zip_file_path>` is the pat
5454

5555
[!INCLUDE [app-service-deploy-zip-push-rest](../../includes/app-service-deploy-zip-push-rest.md)]
5656

57+
## <a name="arm"></a>Deploy by using ARM Template
58+
59+
You can use [ZipDeploy ARM template extension](https://github.com/projectkudu/kudu/wiki/MSDeploy-VS.-ZipDeploy#zipdeploy) to push your .zip file to your function app.
60+
61+
### Example ZipDeploy ARM Template
62+
63+
This template includes both a production and staging slot and deploys to one or the other. Typically, you would use this template to deploy to the staging slot and then swap to get your new zip package running on the production slot.
64+
65+
```json
66+
{
67+
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
68+
"contentVersion": "1.0.0.0",
69+
"parameters": {
70+
"appServiceName": {
71+
"type": "string"
72+
},
73+
"deployToProduction": {
74+
"type": "bool",
75+
"defaultValue": false
76+
},
77+
"slot": {
78+
"type": "string",
79+
"defaultValue": "staging"
80+
},
81+
"packageUri": {
82+
"type": "secureString"
83+
}
84+
},
85+
"resources": [
86+
{
87+
"condition": "[parameters('deployToProduction')]",
88+
"type": "Microsoft.Web/sites/extensions",
89+
"apiVersion": "2021-02-01",
90+
"name": "[format('{0}/ZipDeploy', parameters('appServiceName'))]",
91+
"properties": {
92+
"packageUri": "[parameters('packageUri')]",
93+
"appOffline": true
94+
}
95+
},
96+
{
97+
"condition": "[not(parameters('deployToProduction'))]",
98+
"type": "Microsoft.Web/sites/slots/extensions",
99+
"apiVersion": "2021-02-01",
100+
"name": "[format('{0}/{1}/ZipDeploy', parameters('appServiceName'), parameters('slot'))]",
101+
"properties": {
102+
"packageUri": "[parameters('packageUri')]",
103+
"appOffline": true
104+
}
105+
}
106+
]
107+
}
108+
```
109+
110+
For the initial deployment, you would deploy directly to the production slot. For more information, see [Slot deployments](functions-infrastructure-as-code.md#slot-deployments).
111+
57112
## Run functions from the deployment package
58113

59114
You can also choose to run your functions directly from the deployment package file. This method skips the deployment step of copying files from the package to the `wwwroot` directory of your function app. Instead, the package file is mounted by the Functions runtime, and the contents of the `wwwroot` directory become read-only.

articles/azure-functions/functions-app-settings.md

Lines changed: 27 additions & 17 deletions
Large diffs are not rendered by default.

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

Lines changed: 944 additions & 1014 deletions
Large diffs are not rendered by default.

articles/azure-functions/functions-premium-plan.md

Lines changed: 38 additions & 37 deletions
Large diffs are not rendered by default.
78.8 KB
Loading

articles/azure-functions/storage-considerations.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ ms.date: 06/13/2023
77

88
# Storage considerations for Azure Functions
99

10-
Azure Functions requires an Azure Storage account when you create a function app instance. The following storage services may be used by your function app:
10+
Azure Functions requires an Azure Storage account when you create a function app instance. The following storage services could be used by your function app:
1111

1212
|Storage service | Functions usage |
1313
|---------|---------|
14-
| [Azure Blob Storage](../storage/blobs/storage-blobs-introduction.md) | Maintain bindings state and function keys<sup>1</sup>. <br/>Used by default for [task hubs in Durable Functions](durable/durable-functions-task-hubs.md). <br/>May be used to store function app code for [Linux Consumption remote build](functions-deployment-technologies.md#remote-build) or as part of [external package URL deployments](functions-deployment-technologies.md#external-package-url). |
14+
| [Azure Blob Storage](../storage/blobs/storage-blobs-introduction.md) | Maintain bindings state and function keys<sup>1</sup>. <br/>Used by default for [task hubs in Durable Functions](durable/durable-functions-task-hubs.md). <br/>Can be used to store function app code for [Linux Consumption remote build](functions-deployment-technologies.md#remote-build) or as part of [external package URL deployments](functions-deployment-technologies.md#external-package-url). |
1515
| [Azure Files](../storage/files/storage-files-introduction.md)<sup>2</sup> | File share used to store and run your function app code in a [Consumption Plan](consumption-plan.md) and [Premium Plan](functions-premium-plan.md). <br/> |
1616
| [Azure Queue Storage](../storage/queues/storage-queues-introduction.md) | Used by default for [task hubs in Durable Functions](durable/durable-functions-task-hubs.md). Used for failure and retry handling in [specific Azure Functions triggers](./functions-bindings-storage-blob-trigger.md). Used for object tracking by the [Blob Storage trigger](functions-bindings-storage-blob-trigger.md). |
1717
| [Azure Table Storage](../storage/tables/table-storage-overview.md) | Used by default for [task hubs in Durable Functions](durable/durable-functions-task-hubs.md). |
@@ -26,7 +26,7 @@ You must strongly consider the following facts regarding the storage accounts us
2626

2727
+ When your function app is hosted on the Consumption plan or Premium plan, your function code and configuration files are stored in Azure Files in the linked storage account. When you delete this storage account, the content is deleted and can't be recovered. For more information, see [Storage account was deleted](functions-recover-storage-account.md#storage-account-was-deleted)
2828

29-
+ Important data, such as function code, [access keys](functions-bindings-http-webhook-trigger.md#authorization-keys), and other important service-related data, may be persisted in the storage account. You must carefully manage access to the storage accounts used by function apps in the following ways:
29+
+ Important data, such as function code, [access keys](functions-bindings-http-webhook-trigger.md#authorization-keys), and other important service-related data, can be persisted in the storage account. You must carefully manage access to the storage accounts used by function apps in the following ways:
3030

3131
+ Audit and limit the access of apps and users to the storage account based on a least-privilege model. Permissions to the storage account can come from [data actions in the assigned role](../role-based-access-control/role-definitions.md#control-and-data-actions) or through permission to perform the [listKeys operation].
3232

@@ -58,7 +58,7 @@ The storage account must be accessible to the function app. If you need to use a
5858

5959
By default, function apps configure the `AzureWebJobsStorage` connection as a connection string stored in the [AzureWebJobsStorage application setting](./functions-app-settings.md#azurewebjobsstorage), but you can also [configure AzureWebJobsStorage to use an identity-based connection](functions-reference.md#connecting-to-host-storage-with-an-identity) without a secret.
6060

61-
Function apps are configured to use Azure Files by storing a connection string in the [WEBSITE_CONTENTAZUREFILECONNECTIONSTRING application setting](./functions-app-settings.md#website_contentazurefileconnectionstring) and providing the name of the file share in the [WEBSITE_CONTENTSHARE application setting](./functions-app-settings.md#website_contentshare).
61+
Function apps running in a Consumption plan (Windows only) or an Elastic Premium plan (Windows or Linux) can use Azure Files to store the images required to enable dynamic scaling. For these plans, set the connection string for the storage account in the [WEBSITE_CONTENTAZUREFILECONNECTIONSTRING](./functions-app-settings.md#website_contentazurefileconnectionstring) setting and the name of the file share in the [WEBSITE_CONTENTSHARE](./functions-app-settings.md#website_contentshare) setting. This is usually the same account used for `AzureWebJobsStorage`. You can also [create a function app that doesn't use Azure Files](#create-an-app-without-azure-files), but scaling might be limited.
6262

6363
> [!NOTE]
6464
> A storage account connection string must be updated when you regenerate storage keys. [Read more about storage key management here](../storage/common/storage-account-create.md).
@@ -67,15 +67,15 @@ Function apps are configured to use Azure Files by storing a connection string i
6767

6868
It's possible for multiple function apps to share the same storage account without any issues. For example, in Visual Studio you can develop multiple apps using the [Azurite storage emulator](functions-develop-local.md#local-storage-emulator). In this case, the emulator acts like a single storage account. The same storage account used by your function app can also be used to store your application data. However, this approach isn't always a good idea in a production environment.
6969

70-
You may need to use separate storage accounts to [avoid host ID collisions](#avoiding-host-id-collisions).
70+
You might need to use separate storage accounts to [avoid host ID collisions](#avoiding-host-id-collisions).
7171

7272
### Lifecycle management policy considerations
7373

74-
You shouldn't apply [lifecycle management policies](../storage/blobs/lifecycle-management-overview.md) to your Blob Storage account used by your function app. Functions uses Blob storage to persist important information, such as [function access keys](functions-bindings-http-webhook-trigger.md#authorization-keys), and policies may remove blobs (such as keys) needed by the Functions host. If you must use policies, exclude containers used by Functions, which are prefixed with `azure-webjobs` or `scm`.
74+
You shouldn't apply [lifecycle management policies](../storage/blobs/lifecycle-management-overview.md) to your Blob Storage account used by your function app. Functions uses Blob storage to persist important information, such as [function access keys](functions-bindings-http-webhook-trigger.md#authorization-keys), and policies could remove blobs (such as keys) needed by the Functions host. If you must use policies, exclude containers used by Functions, which are prefixed with `azure-webjobs` or `scm`.
7575

7676
### Storage logs
7777

78-
Because function code and keys may be persisted in the storage account, logging of activity against the storage account is a good way to monitor for unauthorized access. Azure Monitor resource logs can be used to track events against the storage data plane. See [Monitoring Azure Storage](../storage/blobs/monitor-blob-storage.md) for details on how to configure and examine these logs.
78+
Because function code and keys might be persisted in the storage account, logging of activity against the storage account is a good way to monitor for unauthorized access. Azure Monitor resource logs can be used to track events against the storage data plane. See [Monitoring Azure Storage](../storage/blobs/monitor-blob-storage.md) for details on how to configure and examine these logs.
7979

8080
The [Azure Monitor activity log](../azure-monitor/essentials/activity-log.md) shows control plane events, including the [listKeys operation]. However, you should also configure resource logs for the storage account to track subsequent use of keys or other identity-based data plane operations. You should have at least the [StorageWrite log category](../storage/blobs/monitor-blob-storage.md#collection-and-routing) enabled to be able to identify modifications to the data outside of normal Functions operations.
8181

@@ -135,7 +135,7 @@ You can use the following strategies to avoid host ID collisions:
135135
+ Set an explicit host ID for one or more of the colliding apps. To learn more, see [Host ID override](#override-the-host-id).
136136

137137
> [!IMPORTANT]
138-
> Changing the storage account associated with an existing function app or changing the app's host ID can impact the behavior of existing functions. For example, a Blob Storage trigger tracks whether it's processed individual blobs by writing receipts under a specific host ID path in storage. When the host ID changes or you point to a new storage account, previously processed blobs may be reprocessed.
138+
> Changing the storage account associated with an existing function app or changing the app's host ID can impact the behavior of existing functions. For example, a Blob Storage trigger tracks whether it's processed individual blobs by writing receipts under a specific host ID path in storage. When the host ID changes or you point to a new storage account, previously processed blobs could be reprocessed.
139139
140140
### Override the host ID
141141

@@ -145,9 +145,9 @@ When the collision occurs between slots, you must set a specific host ID for eac
145145

146146
## Azure Arc-enabled clusters
147147

148-
When your function app is deployed to an Azure Arc-enabled Kubernetes cluster, a storage account may not be required by your function app. In this case, a storage account is only required by Functions when your function app uses a trigger that requires storage. The following table indicates which triggers may require a storage account and which don't.
148+
When your function app is deployed to an Azure Arc-enabled Kubernetes cluster, a storage account might not be required by your function app. In this case, a storage account is only required by Functions when your function app uses a trigger that requires storage. The following table indicates which triggers might require a storage account and which don't.
149149

150-
| Not required | May require storage |
150+
| Not required | might require storage |
151151
| --- | --- |
152152
| • [Azure Cosmos DB](functions-bindings-cosmosdb-v2.md)<br/>• [HTTP](functions-bindings-http-webhook.md)<br/>• [Kafka](functions-bindings-kafka.md)<br/>• [RabbitMQ](functions-bindings-rabbitmq.md)<br/>• [Service Bus](functions-bindings-service-bus.md) | • [Azure SQL](functions-bindings-azure-sql.md)<br/>• [Blob storage](functions-bindings-storage-blob.md)<br/>• [Event Grid](functions-bindings-event-grid.md)<br/>• [Event Hubs](functions-bindings-event-hubs.md)<br/>• [IoT Hub](functions-bindings-event-iot.md)<br/>• [Queue storage](functions-bindings-storage-queue.md)<br/>• [SendGrid](functions-bindings-sendgrid.md)<br/>• [SignalR](functions-bindings-signalr-service.md)<br/>• [Table storage](functions-bindings-storage-table.md)<br/>• [Timer](functions-bindings-timer.md)<br/>• [Twilio](functions-bindings-twilio.md)
153153

@@ -157,7 +157,7 @@ Creating your function app resources using methods other than the Azure CLI requ
157157

158158
## Create an app without Azure Files
159159

160-
Azure Files is set up by default for Elastic Premium and non-Linux Consumption plans to serve as a shared file system in high-scale scenarios. The file system is used by the platform for some features such as log streaming, but it primarily ensures consistency of the deployed function payload. When an app is [deployed using an external package URL](./run-functions-from-deployment-package.md), the app content is served from a separate read-only file system. This means that you can create your function app without Azure Files. If you create your function app with Azure Files, a writeable file system is still provided. However, this file system may not be available for all function app instances.
160+
Azure Files is set up by default for Elastic Premium and non-Linux Consumption plans to serve as a shared file system in high-scale scenarios. The file system is used by the platform for some features such as log streaming, but it primarily ensures consistency of the deployed function payload. When an app is [deployed using an external package URL](./run-functions-from-deployment-package.md), the app content is served from a separate read-only file system. This means that you can create your function app without Azure Files. If you create your function app with Azure Files, a writeable file system is still provided. However, this file system might not be available for all function app instances.
161161

162162
When Azure Files isn't used, you must meet the following requirements:
163163

@@ -166,7 +166,7 @@ When Azure Files isn't used, you must meet the following requirements:
166166
* The app can't use version 1.x of the Functions runtime.
167167
* Log streaming experiences in clients such as the Azure portal default to file system logs. You should instead rely on Application Insights logs.
168168

169-
If the above are properly accounted for, you may create the app without Azure Files. Create the function app without specifying the `WEBSITE_CONTENTAZUREFILECONNECTIONSTRING` and `WEBSITE_CONTENTSHARE` application settings. You can avoid these settings by generating an ARM template for a standard deployment, removing the two settings, and then deploying the template.
169+
If the above are properly accounted for, you could create the app without Azure Files. Create the function app without specifying the `WEBSITE_CONTENTAZUREFILECONNECTIONSTRING` and `WEBSITE_CONTENTSHARE` application settings. You can avoid these settings by generating an ARM template for a standard deployment, removing the two settings, and then deploying the template.
170170

171171
Because Functions use Azure Files during parts of the dynamic scale-out process, scaling could be limited when running without Azure Files on Consumption and Elastic Premium plans.
172172

@@ -194,7 +194,7 @@ For a complete example, see the script in [Create a serverless Python function a
194194

195195
---
196196

197-
Currently, only a `storage-type` of `AzureFiles` is supported. You can only mount five shares to a given function app. Mounting a file share may increase the cold start time by at least 200-300 ms, or even more when the storage account is in a different region.
197+
Currently, only a `storage-type` of `AzureFiles` is supported. You can only mount five shares to a given function app. Mounting a file share can increase the cold start time by at least 200-300 ms, or even more when the storage account is in a different region.
198198

199199
The mounted share is available to your function code at the `mount-path` specified. For example, when `mount-path` is `/path/to/mount`, you can access the target directory by file system APIs, as in the following Python example:
200200

0 commit comments

Comments
 (0)