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 setsWEBSITE_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 preventWEBSITE_RUN_FROM_PACKAGE
from being set to1
. - To Achieve a Writable
wwwroot
, In your Azure DevOps Pipeline it is recommended to modify yourAzureRmWebAppDeployment@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 theWeb Deploy
mechanism to push the content of your ZIP file. - This Deployment type unpacks the ZIP into
wwwroot
, preventingWEBSITE_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.