Run your Azure Functions from a package file
The functionality described in this article is not available for function apps running on Linux in an App Service plan.
In Azure, you can run your functions directly from a deployment package file in your function app. The other option is to deploy your files in the
d:\home\site\wwwroot directory of your function app.
This article describes the benefits of running your functions from a package. It also shows how to enable this functionality in your function app.
Benefits of running from a package file
There are several benefits to running from a package file:
- Reduces the risk of file copy locking issues.
- Can be deployed to a production app (with restart).
- You can be certain of the files that are running in your app.
- Improves the performance of Azure Resource Manager deployments.
For more information, see this announcement.
Enabling functions to run from a package
To enable your function app to run from a package, you just add a
WEBSITE_RUN_FROM_PACKAGE setting to your function app settings. The
WEBSITE_RUN_FROM_PACKAGE setting can have one of the following values:
||Recommended for function apps running on Windows. Run from a package file in the
||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) to enable the Functions runtime to access to the package. You can use the Azure Storage Explorer to upload package files to your Blob storage account.|
When running a function app on Windows, the external URL option yields worse cold-start performance. When deploying your function app to Windows, you should set
1 and publish with zip deployment.
The following shows a function app configured to run from a .zip file hosted in Azure Blob storage:
Currently, only .zip package files are supported.
Integration with zip deployment
Zip deployment 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_PACKAGE 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.
Adding the WEBSITE_RUN_FROM_PACKAGE setting
There are several ways that you can add, update, and delete function app settings:
- Run From Package makes
wwwrootread-only, so you will receive an error when writing files to this directory.
- Tar and gzip formats are not supported.
- This feature does not compose with local cache.
- For improved cold-start performance, use the local Zip option (