-
Notifications
You must be signed in to change notification settings - Fork 203
How to configure WEBSITE_RUN_FROM_PACKAGE in Azure App Service
In Azure App Service, you can run your apps directly from a deployment ZIP package file. This article shows how to enable/disable this functionality in your app.
When you enable this functionality in your Azure App Service, the files in the package are not copied to the wwwroot directory. Instead, the ZIP package itself gets mounted directly as the read-only wwwroot directory. There are several benefits to running directly from a package:
- Eliminates file lock conflicts between deployment and runtime.
- Ensures only full-deployed apps are running at any time.
- Can be deployed to a production app (with restart).
- Improves the performance of Azure Resource Manager deployments.
- May reduce cold-start times, particularly for JavaScript functions with large npm package trees.
There are also some limitations to running from a package:
- The wwwroot folder becomes read-only and you'll receive an error when writing files to this directory. Files are also read-only in the Azure portal.
- The maximum size for a deployment package file is currently 1 GB.
- Can't use local cache or local DB when running from a deployment package.
- Can't use remote build
You can find more details in the following links:
https://learn.microsoft.com/en-us/azure/app-service/deploy-run-package
- Make sure that the version of Node.js on your machine is the same as the Node.js version on App Service.
- Check your .webappignore file at the project root, make sure all the dependencies that running required are not excluded by this file.
- Enable
WEBSITE_RUN_FROM_PACKAGE
app setting in your Azure App Service. Below are three methods you can choose from.- Add WEBSITE_RUN_FROM_PACKAGE flag to your bicep file.
- Follow the documentation do it manually.
- Go to Azure Portal. Navigate to your App Service - Setting - Configuration - Applications settings, + New application setting, Name: WEBSITE_RUN_FROM_PACKAGE, Value: 1, Click OK.
-
Make sure there is no
SCM_SCRIPT_GENERATOR_ARGS
setting in your Azure App Service, check this configuration in the Azure portal - Your App Service - Setting - Configuration - Applications settings. If your project is upgraded from the old version, this setting may be set to--node
. Remove this setting before deploying your project. You may also have theSCM_DO_BUILD_DURING_DEPLOYMENT
setting in your configuration. Technically, this setting has a lower priority thanWEBSITE_RUN_FROM_PACKAGE
, but for the sake of avoiding confusion, it's best to delete this setting as well. - Put the
web.config
file to the root of the project if your project is using nodeJS. You can find the template file from here and example from here and more examples from our repo. If your project is built by Dotnet, skip this step. - Restart the App Service, and redeploy again.
- Remove
WEBSITE_RUN_FROM_PACKAGE
app setting from your Azure App Service. - If your project is built by nodeJS and you already have a
web.config
file in your project root, you can keep this file and everything is fine now. If you want to delete theweb.config
file, remember to enable the build process or setSCM_SCRIPT_GENERATOR_ARGS=--node
(This option will also need you to upload all the dependencies to the Azure App Service). - Adjust your .webappignore file at the project root, make sure all source code is not excluded by this file. This file excludes *.ts files by default. If you enabled the build process during deploy, you should upload all the source code to the App Service. If you use
SCM_SCRIPT_GENERATOR_ARGS=--node
option or keep theweb.config
at the project root, skip this step. - Restart the App Service, and redeploy again.
Make sure you have removed the COMMAND
and SCM_SCRIPT_GENERATOR_ARGS
settings in your Azure App Service.
Please refer to this page to find solve.
Build Custom Engine Copilots
- Build a basic AI chatbot for Teams
- Build an AI agent chatbot for Teams
- Expand AI bot's knowledge with your content
Scenario-based Tutorials
- Send notifications to Teams
- Respond to chat commands in Teams
- Respond to card actions in Teams
- Embed a dashboard canvas in Teams
Extend your app across Microsoft 365
- Teams tabs in Microsoft 365 and Outlook
- Teams message extension for Outlook
- Add Outlook Add-in to a Teams app
App settings and Microsoft Entra Apps
- Manage Application settings with Teams Toolkit
- Manage Microsoft Entra Application Registration with Teams Toolkit
- Use an existing Microsoft Entra app
- Use a multi-tenant Microsoft Entra app
Configure multiple capabilities
- How to configure Tab capability within your Teams app
- How to configure Bot capability within your Teams app
- How to configure Message Extension capability within your Teams app
Add Authentication to your app
- How to add single sign on in Teams Toolkit for Visual Studio Code
- How to enable Single Sign-on in Teams Toolkit for Visual Studio
Connect to cloud resources
- How to integrate Azure Functions with your Teams app
- How to integrate Azure API Management
- Integrate with Azure SQL Database
- Integrate with Azure Key Vault
Deploy apps to production