Skip to content

Commit 857df58

Browse files
authored
Merge pull request #48887 from ggailey777/current
Run from zip draft
2 parents f87e270 + a20f010 commit 857df58

File tree

8 files changed

+156
-26
lines changed

8 files changed

+156
-26
lines changed

articles/azure-functions/TOC.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,10 @@
162162
items:
163163
- name: Continuous deployment
164164
href: functions-continuous-deployment.md
165-
- name: Zip push deployment
165+
- name: Zip deployment
166166
href: deployment-zip-push.md
167+
- name: Run from zip file
168+
href: run-functions-from-deployment-package.md
167169
- name: Automate resource deployment
168170
href: functions-infrastructure-as-code.md
169171
- name: On-premises functions

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

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,68 +4,71 @@ description: Use the .zip file deployment facilities of the Kudu deployment serv
44
services: functions
55
documentationcenter: na
66
author: ggailey777
7-
manager: cfowler
7+
manager: jeconnoc
88
editor: ''
99
tags: ''
1010

1111
ms.service: functions
1212
ms.devlang: multiple
13-
ms.topic: article
13+
ms.topic: conceptual
1414
ms.tgt_pltfrm: multiple
1515
ms.workload: na
16-
ms.date: 05/29/2018
16+
ms.date: 08/12/2018
1717
ms.author: glenga
1818

1919
---
20-
# Zip push deployment for Azure Functions
21-
This article describes how to deploy your function app project files to Azure from a .zip (compressed) file. You learn how to do a push deployment, both by using Azure CLI and by using the REST APIs.
2220

23-
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).
21+
# Zip deployment for Azure Functions
2422

25-
For faster iteration during development, it's often easier to deploy your function app project files directly from a compressed .zip file. This .zip file deployment uses the same Kudu service that powers continuous integration-based deployments, including:
23+
This article describes how to deploy your function app project files to Azure from a .zip (compressed) file. You learn how to do a push deployment, both by using Azure CLI and by using the REST APIs. [Azure Functions Core Tools](functions-run-local.md) also uses these deployment APIs when publishing a local project to Azure.
24+
25+
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).
26+
27+
To speed 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:
2628

2729
+ Deletion of files that were left over from earlier deployments.
2830
+ Deployment customization, including running deployment scripts.
2931
+ Deployment logs.
3032
+ Syncing function triggers in a [Consumption plan](functions-scale.md) function app.
3133

32-
For more information, see the [.zip push deployment reference](https://github.com/projectkudu/kudu/wiki/Deploying-from-a-zip-file).
34+
For more information, see the [.zip deployment reference](https://github.com/projectkudu/kudu/wiki/Deploying-from-a-zip-file).
3335

3436
## Deployment .zip file requirements
35-
The .zip file that you use for push deployment must contain all of the project files in your function app, including your function code.
37+
38+
The .zip file that you use for push deployment must contain all of the files needed to run your function.
3639

3740
>[!IMPORTANT]
38-
> When you use .zip push deployment, any files from an existing deployment that aren't found in the .zip file are deleted from your function app.
41+
> When you use .zip deployment, any files from an existing deployment that aren't found in the .zip file are deleted from your function app.
3942
4043
[!INCLUDE [functions-folder-structure](../../includes/functions-folder-structure.md)]
4144

42-
A function app includes all of the files and folders in the `wwwroot` directory. A .zip file deployment includes the contents of the `wwwroot` directory, but not the directory itself.
45+
A function app includes all of the files and folders in the `wwwroot` directory. A .zip file deployment includes the contents of the `wwwroot` directory, but not the directory itself. When deploying a C# class library project, you must include the compiled library files and dependencies in a `bin` subfolder in your .zip package.
4346

4447
## Download your function app files
4548

46-
When you are developing on a local computer, it's easy to create a .zip file of the function app project folder on your development computer.
49+
When you are developing on a local computer, it's easy to create a .zip file of the function app project folder on your development computer.
4750

48-
However, you might have created your functions by using the editor in the Azure portal. You can download an existing function app project in one of these ways:
51+
However, you might have created your functions by using the editor in the Azure portal. You can download an existing function app project in one of these ways:
4952

50-
+ **From the Azure portal:**
53+
+ **From the Azure portal:**
5154

5255
1. Sign in to the [Azure portal](https://portal.azure.com), and then go to your function app.
5356

54-
2. On the **Overview** tab, select **Download app content**. Select your download options, and then select **Download**.
57+
2. On the **Overview** tab, select **Download app content**. Select your download options, and then select **Download**.
5558

5659
![Download the function app project](./media/deployment-zip-push/download-project.png)
5760

5861
The downloaded .zip file is in the correct format to be republished to your function app by using .zip push deployment. The portal download can also add the files needed to open your function app directly in Visual Studio.
5962

60-
+ **Using REST APIs:**
63+
+ **Using REST APIs:**
6164

6265
Use the following deployment GET API to download the files from your `<function_app>` project:
6366

6467
https://<function_app>.scm.azurewebsites.net/api/zip/site/wwwroot/
6568

66-
Including `/site/wwwroot/` makes sure your zip file includes only the function app project files and not the entire site. If you are not already signed in to Azure, you will be asked to do so. Note that sending a POST request to the `api/zip/` API is discoraged in favor of the zip deployment method described in this topic.
69+
Including `/site/wwwroot/` makes sure your zip file includes only the function app project files and not the entire site. If you are not already signed in to Azure, you will be asked to do so.
6770

68-
You can also download a .zip file from a GitHub repository. Keep in mind that when you download a GitHub repository as a .zip file, GitHub adds an extra folder level for the branch. This extra folder level means that you can't deploy the .zip file directly as you downloaded it from GitHub. If you're using a GitHub repository to maintain your function app, you should use [continuous integration](functions-continuous-deployment.md) to deploy your app.
71+
You can also download a .zip file from a GitHub repository. When you download a GitHub repository as a .zip file, GitHub adds an extra folder level for the branch. This extra folder level means that you can't deploy the .zip file directly as you downloaded it from GitHub. If you're using a GitHub repository to maintain your function app, you should use [continuous integration](functions-continuous-deployment.md) to deploy your app.
6972

7073
## <a name="cli"></a>Deploy by using Azure CLI
7174

@@ -77,13 +80,22 @@ In the following command, replace the `<zip_file_path>` placeholder with the pat
7780
az functionapp deployment source config-zip -g myResourceGroup -n \
7881
<app_name> --src <zip_file_path>
7982
```
83+
8084
This command deploys project files from the downloaded .zip file to your function app in Azure. It then restarts the app. To view the list of deployments for this function app, you must use the REST APIs.
8185

8286
When you're using Azure CLI on your local computer, `<zip_file_path>` is the path to the .zip file on your computer. You can also run Azure CLI in [Azure Cloud Shell](../cloud-shell/overview.md). When you use Cloud Shell, you must first upload your deployment .zip file to the Azure Files account that's associated with your Cloud Shell. In that case, `<zip_file_path>` is the storage location that your Cloud Shell account uses. For more information, see [Persist files in Azure Cloud Shell](../cloud-shell/persisting-shell-storage.md).
8387

84-
8588
[!INCLUDE [app-service-deploy-zip-push-rest](../../includes/app-service-deploy-zip-push-rest.md)]
8689

90+
## Run functions from the deployment package
91+
92+
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.
93+
94+
> [!NOTE]
95+
> The ability to run your function app from the deployment package is in preview.
96+
97+
Zip deployment integrates with this feature, which you can enable by setting the function app setting `WEBSITE_RUN_FROM_ZIP` to a value of `1`. For more information, see [Run your functions from a deployment package file](run-functions-from-deployment-package.md).
98+
8799
[!INCLUDE [app-service-deploy-zip-push-custom](../../includes/app-service-deploy-zip-push-custom.md)]
88100

89101
## Next steps

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

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: App settings reference for Azure Functions
33
description: Reference documentation for the Azure Functions app settings or environment variables.
44
services: functions
55
author: ggailey777
6-
manager: cfowler
6+
manager: jeconnoc
77
editor: ''
88
tags: ''
99
keywords:
@@ -12,14 +12,16 @@ ms.devlang: multiple
1212
ms.topic: article
1313
ms.tgt_pltfrm: multiple
1414
ms.workload: na
15-
ms.date: 09/26/2017
15+
ms.date: 08/22/2018
1616
ms.author: glenga
1717
---
1818

1919
# App settings reference for Azure Functions
2020

2121
App settings in a function app contain global configuration options that affect all functions for that function app. When you run locally, these settings are in environment variables. This article lists the app settings that are available in function apps.
2222

23+
[!INCLUDE [Function app settings](../../includes/functions-app-settings.md]
24+
2325
There are other global configuration options in the [host.json](functions-host-json.md) file and in the [local.settings.json](functions-run-local.md#local-settings-file) file.
2426

2527
## APPINSIGHTS_INSTRUMENTATIONKEY
@@ -122,7 +124,7 @@ For consumption plans only. Connection string for storage account where the func
122124
|---|------------|
123125
|WEBSITE_CONTENTAZUREFILECONNECTIONSTRING|DefaultEndpointsProtocol=https;AccountName=[name];AccountKey=[key]|
124126

125-
## WEBSITE_CONTENTSHARE
127+
## WEBSITE\_CONTENTSHARE
126128

127129
For consumption plans only. The file path to the function app code and configuration. Used with WEBSITE_CONTENTAZUREFILECONNECTIONSTRING. Default is a unique string that begins with the function app name. See [Create a function app](functions-infrastructure-as-code.md#create-a-function-app).
128130

@@ -149,6 +151,19 @@ Default is "6.5.0".
149151
|---|------------|
150152
|WEBSITE\_NODE\_DEFAULT_VERSION|6.5.0|
151153

154+
## WEBSITE\_RUN\_FROM\_ZIP
155+
156+
Enables your function app to run from a mounted package file.
157+
158+
> [!NOTE]
159+
> This setting is for a preview feature.
160+
161+
|Key|Sample value|
162+
|---|------------|
163+
|WEBSITE\_RUN\_FROM\_ZIP|1|
164+
165+
Valid values are either a URL that resolves to the location of a deployment package file, or `1`. When set to `1`, the package must be in the `d:\home\data\SitePackages` folder. When using zip deployment with this setting, the package is automatically uploaded to this location. For more information, see [Run your functions from a package file](run-functions-from-deployment-package.md).
166+
152167
## Next steps
153168

154169
[Learn how to update app settings](functions-how-to-use-azure-function-app-settings.md#manage-app-service-settings)
13.2 KB
Loading
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
title: Run your Azure Functions from a package | Microsoft Docs
3+
description: Have the Azure Functions runtime run your functions by mounting a deployment package file that contains your function app project files.
4+
services: functions
5+
documentationcenter: na
6+
author: ggailey777
7+
manager: jeconnoc
8+
editor: ''
9+
tags: ''
10+
11+
ms.service: functions
12+
ms.devlang: multiple
13+
ms.topic: conceptual
14+
ms.workload: na
15+
ms.date: 08/22/2018
16+
ms.author: glenga
17+
18+
---
19+
20+
# Run your Azure Functions from a package file
21+
22+
> [!NOTE]
23+
> The functionality described in this article is currently in preview; it is not available for Functions on Linux.
24+
25+
In Azure, you can run your functions directly from a deployment package file in your function app. The other option is to deploy your function project files in the `d:\home\site\wwwroot` directory of your function app.
26+
27+
This article describes the benefits of running your functions from a package. It also shows how to enable this functionality in your function app.
28+
29+
## Benefits of running from a package file
30+
31+
There are several benefits to running from a package file:
32+
33+
+ Reduces the risk of file copy locking issues.
34+
+ Can be deployed to a production app (with restart).
35+
+ You can be certain of the files that are running in your app.
36+
+ Improves the performance of [Azure Resource Manager deployments](functions-infrastructure-as-code.md).
37+
+ May reduce the cold-start time of JavaScript functions.
38+
39+
For more information, see [this announcement](https://github.com/Azure/app-service-announcements/issues/84).
40+
41+
## Enabling functions to run from a package
42+
43+
To enable your function app to run from a package, you just add a `WEBSITE_RUN_FROM_ZIP` setting to your function app settings. The `WEBSITE_RUN_FROM_ZIP` setting can have one of the following values:
44+
45+
| Value | Description |
46+
|---------|---------|
47+
|**`<url>`** | Location of a specific package file you want to run. When using Blob storage, you should use a private container with a [Shared Access Signature (SAS)](../vs-azure-tools-storage-manage-with-storage-explorer.md#attach-a-storage-account-by-using-a-shared-access-signature-sas) to enable the Functions runtime to access to the package. You can use the [Azure Storage Explorer](https://azure.microsoft.com/features/storage-explorer/) to upload package files to your Blob storage account. |
48+
| **`1`** | Run from a package file in the `d:\home\data\SitePackages` folder of your function app. This option requires the folder to also have a file named `packagename.txt`. This file contains only the name of the package file in folder, without any whitespace. |
49+
50+
The following shows a function app configured to run from a .zip file hosted in Azure Blob storage:
51+
52+
![WEBSITE_RUN_FROM_ZIP app setting](./media/run-functions-from-deployment-package/run-from-zip-app-setting-portal.png)
53+
54+
> [!NOTE]
55+
> Currently, only .zip package files are supported.
56+
57+
## Integration with zip deployment
58+
59+
[Zip deployment][Zip deployment for Azure Functions] is a feature of Azure App Service that lets you deploy your function app project to the `wwwroot` directory. The project is packaged as a .zip deployment file. The same APIs can be used to deploy your package to the `d:\home\data\SitePackages` folder. With the `WEBSITE_RUN_FROM_ZIP` app setting value of `1`, the zip deployment APIs copy your package to the `d:\home\data\SitePackages` folder instead of extracting the files to `d:\home\site\wwwroot`. It also creates the `packagename.txt` file. The function app is then run from the package after a restart, and `wwwroot` becomes read-only. For more information about zip deployment, see [Zip deployment for Azure Functions](deployment-zip-push.md).
60+
61+
## Adding the WEBSITE_RUN_FROM_ZIP setting
62+
63+
[!INCLUDE [Function app settings](../../includes/functions-app-settings.md]
64+
65+
## Next steps
66+
67+
> [!div class="nextstepaction"]
68+
> [Continuous deployment for Azure Functions](functions-continuous-deployment.md)
69+
70+
[Zip deployment for Azure Functions]: deployment-zip-push.md

includes/app-service-deploy-zip-push-rest.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The following example uses the cURL tool to deploy a .zip file. Replace the plac
1212
curl -X POST -u <deployment_user> --data-binary @"<zip_file_path>" https://<app_name>.scm.azurewebsites.net/api/zipdeploy
1313
```
1414

15-
This request triggers push deployment from the uploaded .zip file. You can review the current and past deployments by using the https://<app_name>.scm.azurewebsites.net/api/deployments endpoint, as shown in the following cURL example. Again, replace `<app_name>` with the name of your app and `<deployment_user>` with the username of your deployment credentials.
15+
This request triggers push deployment from the uploaded .zip file. You can review the current and past deployments by using the `https://<app_name>.scm.azurewebsites.net/api/deployments` endpoint, as shown in the following cURL example. Again, replace `<app_name>` with the name of your app and `<deployment_user>` with the username of your deployment credentials.
1616

1717
```bash
1818
curl -u <deployment_user> https://<app_name>.scm.azurewebsites.net/api/deployments

includes/functions-app-settings.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
title: include file
3+
description: include file
4+
services: functions
5+
author: ggailey777
6+
manager: jeconnoc
7+
ms.service: functions
8+
ms.topic: include
9+
ms.date: 08/15/2018
10+
ms.author: glenga
11+
ms.custom: include file
12+
---
13+
14+
There are several ways that you can add, update, and delete function app settings:
15+
16+
+ [In the Azure portal.](../articles/azure-functions/functions-how-to-use-azure-function-app-settings.md#settings)
17+
+ [By using the Azure CLI.](https://docs.microsoft.com/cli/azure/functionapp/config/appsettings#az-functionapp-config-appsettings-set)

includes/functions-folder-structure.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
1+
---
2+
title: include file
3+
description: include file
4+
services: functions
5+
author: ggailey777
6+
manager: jeconnoc
7+
ms.service: functions
8+
ms.topic: include
9+
ms.date: 08/12/2018
10+
ms.author: glenga
11+
ms.custom: include file
12+
---
113

2-
The code for all the functions in a specific function app is located in a root folder that contains a host configuration file and one or more subfolders. Each subfolder contains the code for a separate function, as in the following example:
14+
The code for all the functions in a specific function app is located in a root folder (`wwwroot`) that contains a host configuration file and one or more subfolders. Each subfolder contains the code for a separate function, as in the following example:
315

416
```
517
wwwroot
@@ -13,9 +25,11 @@ wwwroot
1325
| - mycsharpfunction
1426
| | - function.json
1527
| | - run.csx
28+
| - bin
29+
| | - mycompiledcsharp.dll
1630
```
1731

1832
The host.json file contains some runtime-specific configurations, and sits in the root folder of the function app. For information about settings that are available, see the [host.json reference](../articles/azure-functions/functions-host-json.md).
1933

20-
Each function has a folder that contains one or more code files, the function.json configuration, and other dependencies.
34+
Each function has a folder that contains one or more code files, the function.json configuration, and other dependencies. For a C# class library project, the compiled class library (.dll) file is deployed to the `bin` subfolder.
2135

0 commit comments

Comments
 (0)