Azure function zip deployment not working with
var appServicePlanData = new AppServicePlanData(region)
{
Sku = new AppServiceSkuDescription
{
Name = "Y1",
Tier = "Consumption",
Size = "Y1"
},
Kind = "functionapp",
};
when WebsiteRunFromPackage is set to 0. but working fine when WebsiteRunFromPackage is set to 1.
I am using zip deplyment approach. Here is the url for that.
string zipDeployUrl = $"https://{functionAppName}.scm.azurewebsites/api/zipdeploy";
I alredy tried by setting WebsiteRunFromPackage value to 1 and it is working fine with that. Need to know how to make it work with 0 because I don't want my wwwroot folder to be readonly.
Azure function zip deployment not working with
var appServicePlanData = new AppServicePlanData(region)
{
Sku = new AppServiceSkuDescription
{
Name = "Y1",
Tier = "Consumption",
Size = "Y1"
},
Kind = "functionapp",
};
when WebsiteRunFromPackage is set to 0. but working fine when WebsiteRunFromPackage is set to 1.
I am using zip deplyment approach. Here is the url for that.
string zipDeployUrl = $"https://{functionAppName}.scm.azurewebsites/api/zipdeploy";
I alredy tried by setting WebsiteRunFromPackage value to 1 and it is working fine with that. Need to know how to make it work with 0 because I don't want my wwwroot folder to be readonly.
Share Improve this question asked Jan 17 at 15:18 AmitAmit 779 bronze badges1 Answer
Reset to default 0When you use zip deploy, the code will run directly in zip (that is mounted to wwwroot folder thus read only). More technical details here
https://learn.microsoft/en-us/azure/azure-functions/run-functions-from-deployment-package
If you don't want to use zip deploy, you need to deploy all code into wwwroot using normal deploy method. By just set WebsiteRunFromPackage to 0 won't work as there is code in wwwroot folder yet.
Deploy using .ZIP package for Linux Consumption
ZipDeploy extension with the appSetting WEBSITE_RUN_FROM_PACKAGE=1 is not supported only for Linux Consumption plan
. For Linux Consumption plan: Do not use ZipDeploy extension
. Set appSetting WEBSITE_RUN_FROM_PACKAGE=URL for deployment using the .zip package url.
https://github/Azure-Samples/function-app-arm-templates/tree/main/function-app-linux-consumption
Steps to deploy for linux Consumption plan
:
- create a private-access container in the Blob storage
- zip the application files
- upload the ZIP archive to the container
- ask Azure for the URL to the archive
- ask Azure to give you a read-only shared access signature (SAS) to the archive
- construct the full URL
- add a configuration to the function app to run from the zip archive we just uploaded
refer to this great post: https://tomaskohl/code/2022/automated-deployment-linux-azure-functions-app/
The vs code
azure extension is able to deploy to Y1 plan correctly, see below screenshot.