最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Azure function zip deployment not working with consumption plan and WebsiteRunFromPackage is set to 0 - Stack Overflow

programmeradmin8浏览0评论

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 badges
Add a comment  | 

1 Answer 1

Reset to default 0

When 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.

发布评论

评论列表(0)

  1. 暂无评论