WEBSITE_RUN_FROM_PACKAGE keeps resetting, forcing read-only mode

Danny Fournier 0 Reputation points
2025-06-09T17:48:52.3266667+00:00

Despite removing WEBSITE_RUN_FROM_PACKAGE from the App Service settings, it continues to be set during pipeline execution. All input parameters have been reviewed for accuracy, but the setting resets, ensuringwwwroot is always be in read-only mode. The end goal is to not have read-only mode.

The relevant portion of the Pipeline YAML is as follows:

- task: AzureRmWebAppDeployment@5
      displayName: 'Deploy Azure App Service'
      inputs:
        azureSubscription: '$(azureSubscription)'
        appType: '$(WebAppKind)'
        WebAppName: '$(WebAppName)'
        ResourceGroupName: '$(azureResourceGroup)'
        packageForLinux: '$(System.DefaultWorkingDirectory)/*.zip'
        CleanDeploymentFlag: true
        RemoveAdditionalFilesFlag: true
        ConnectionType: 'AzureRM'
        DeploymentTypeLinux: 'oneDeploy'


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

1 answer

Sort by: Most helpful
  1. Harshitha Veeramalla 1,146 Reputation points Microsoft External Staff Moderator
    2025-06-10T11:01:54.06+00:00

    Hi @Danny Fournier,

    As you are deploying a .zip package to an Azure App Service using the AzureRmWebAppDeployment@5 task with DeploymentTypeLinux: oneDeploy, despite of removing the WEBSITE_RUN_FROM_PACKAGE setting, it keeps reappearing during deployment and results in a read-only wwwroot directory.

    • Reason behind this is when you use oneDeploy with a ZIP package, the deployment method automatically sets WEBSITE_RUN_FROM_PACKAGE=1, forcing the app to run from the mounted package - read-only.

    If you want the app to not run in read-only mode, it is recommended to change the deployment method.

    You can use zipdeploy method, as it extracts files into the application root directory wwwroot and avoids setting the variable WEBSITE_RUN_FROM_PACKAGE.

    Refer this GitHub doc which explains zipdeploy.

    • When this task runs with DeploymentTypeLinux: 'webDeploy', it tells Azure to treat the provided .zip as a package to be extracted, rather than mounted. This will prevent WEBSITE_RUN_FROM_PACKAGE from being set to 1.
    • To Achieve a Writable wwwroot, In your Azure DevOps Pipeline it is recommended to modify your AzureRmWebAppDeployment@5 task as below.
    DeploymentTypeLinux: 'webDeploy' # For Linux App Service
    DeploymentType: 'webDeploy' # For Windows App Service 
    
    • Setting DeploymentTypeLinux: 'webDeploy' explicitly tells the deployment task to use the Web Deploy mechanism to push the content of your ZIP file.
    • This Deployment type unpacks the ZIP into wwwroot, preventing WEBSITE_RUN_FROM_PACKAGE=1 from being set by the deployment.

    Refer AzureRmWebAppDeployment@5 - Azure App Service deploy v5 task for more details.

    Update:

    I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this!

    Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to "Accept " the answer.

    The root cause was that the $(WebAppKind) variable was not initialized in Azure DevOps pipeline.

    This happened due to a bad copy/paste from another existing YAML file. Because WebAppKind was empty, the deployment task didn't behave as expected and implicitly caused WEBSITE_RUN_FROM_PACKAGE to be set, resulting in a read-only wwwroot.

    Fix:

    it turns out that $(WebAppKind) wasn't even initialized at my end and was causing the issue. I believe this was caused from a bad copy/paste from another existing pipeline yaml.

    You need to explicitly set the WebAppKind variable in the pipeline with the correct value.

    Please click Accept Answer and kindly upvote it so that other people who faces similar issue may get benefited from it.

    1 person found this answer helpful.

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.