WEBSITE_RUN_FROM_PACKAGE Environment Variable Auto-Creating in App Service Environment

sguidos 5 Reputation points
2024-12-18T03:47:22.8766667+00:00

I have a solution containing an Web App and Web Job project, that I build and deploy with Azure DevOps pipelines, which I deploy to an Azure Windows App Service, using the ZipDeploy option. I can deploy the Web App to my DEV and TEST environments with no problem using my Release Pipeline. When I use the same Release Pipeline to Deploy to my PROD environment, the WEBSITE_RUN_FROM_PACKAGE =1 environment variable mysteriously appears as an Environment Variable. This setting is NOT in my appsettings.json file, or even my User Secrets file. I have compared the 3 Stages of the Release Pipeline and see no differences (other than the environment Subscription and the App Service name).

I have a second similar solution, with a Web App and 2 Web Jobs projects, which Deploys correctly across all 3 environments. I have compared the Build and Release Pipelines from these 2 DevOps projects and can see no differences.

I can use Kudu to view the appsettings.json files in the App Service file system, and there is no WEBSITE_RUN_FROM_PACKAGE entry in them. Kudu also shows WEBSITE_RUN_FROM_PACKAGE = 1 and APPSETTING_WEBSITE_RUN_FROM_PACKAGE = 1 in the Environment page -> Environment Variables section. Also, I will swear that I manually deleted the WEBSITE_RUN_FROM_PACKAGE =1 environment variable from the App Service Portal, only to have it reappear some time later, which makes no sense at all.

Where could this Environment Variable be coming from?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,093 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Divyesh Govaerdhanan 155 Reputation points
    2024-12-23T20:56:48.06+00:00

    Hello,

    Welcome to Microsoft Q&A,

    When using ZipDeploy, Azure automatically sets the WEBSITE_RUN_FROM_PACKAGE variable to 1 to indicate that the application is running directly from a deployed ZIP file. This is a default behavior of the ZipDeploy mechanism. Even if you remove this variable manually, it may be re-applied during subsequent deployments.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.