Run your Azure Functions from a package file

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.
  • May reduce cold-start times, particularly for JavaScript functions with large npm package trees.

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:

Value Description
1 Recommended for function apps running on Windows. Run from a package file in the d:\home\data\SitePackages folder of your function app. If not deploying with zip deploy, 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.
<URL> Location of a specific package file you want to run. When you specify a URL, you must also sync triggers after you publish an updated package.
When using Blob storage, you typically should not use a public blob. Instead, use a private container with a Shared Access Signature (SAS) or use a managed identity to enable the Functions runtime to access 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 WEBSITE_RUN_FROM_PACKAGE to 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.

Fetch a package from Azure Blob Storage using a managed identity

Azure Blob Storage can be configured to authorize requests with Azure AD. This means that instead of generating a SAS key with an expiration, you can instead rely on the application's managed identity. By default, the app's system-assigned identity will be used. If you wish to specify a user-assigned identity, you can set the WEBSITE_RUN_FROM_PACKAGE_BLOB_MI_RESOURCE_ID app setting to the resource ID of that identity. The setting can also accept "SystemAssigned" as a value, although this is the same as omitting the setting altogether.

To enable the package to be fetched using the identity:

  1. Ensure that the blob is configured for private access.

  2. Grant the identity the Storage Blob Data Reader role with scope over the package blob. See Assign an Azure role for access to blob data for details on creating the role assignment.

  3. Set the WEBSITE_RUN_FROM_PACKAGE application setting to the blob URL of the package. This will likely be of the form "https://{storage-account-name}{container-name}/{path-to-package}" or similar.

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. After a restart, the package is mounted to wwwroot as a read-only filesystem. For more information about zip deployment, see Zip deployment for Azure Functions.


When a deployment occurs, a restart of the function app is triggered. Before a restart, all existing function executions are allowed to complete or time out. To learn more, see Deployment behaviors.


There are several ways that you can add, update, and delete function app settings:

Changes to function app settings require your function app to be restarted.


  • Run From Package makes wwwroot read-only, so you will receive an error when writing files to this directory.
  • Tar and gzip formats are not supported.
  • The ZIP file can be at most 1GB.
  • This feature does not compose with local cache.
  • For improved cold-start performance, use the local Zip option (WEBSITE_RUN_FROM_PACKAGE=1).
  • Run From Package is incompatible with deployment customization option (SCM_DO_BUILD_DURING_DEPLOYMENT=true), the build step will be ignored during deployment.

Next steps