简体   繁体   中英

Functions get Remove when zip deploy function app using Azure CLI or PowerShell

I'm facing an issue while deploying the azure function using Azure CLI or Azure PowerShell.

I have already created needed resources like resource group, function app and blob storage.

My function app platform type is Linux with consumption plan and runtime.net6.0. I have created Service Bus trigger function and deployed using Visual Studio Publish profile and it is working as expected.

But when I executed the command to deploy the Azure function using CLI. Command is executing successfully but when I open the function app from azure portal and go to functions blade the deployed functions do not appear there.

I also checked the folder structure of the build output as mentioned in the link

https://learn.microsoft.com/en-us/azure/azure-functions/deployment-zip-push

any help would be appreciated.

Thanks

Reproduced the same issue from our end using Az-CLI

az functionapp deployment source config-zip -g <Resource Group> -n <Function App Name> --src <Function Project with Zip>

在此处输入图像描述

在此处输入图像描述


Workaround to fix the issue

After setting SCM_DO_BUILD_DURING_DEPLOYMENT to true in Configuration > Application Settings of the Azure Function App in Portal and deployed again using AZ CLI commands and shown the functions in Portal and in Kudu site of wwwroot folder.

在此处输入图像描述

AZ CLI Command:

az functionapp deployment source config-zip -g HariTestRG -n KrishNet6FuncApp --src "C:/Users/Hari/source/repos/DotNet6/TimerTrigger1205.zip"

在此处输入图像描述

According to this MS DOC , we came to know that some deployment customization has to be done before deploying the Function App as a Zip Push, ie, by default the app setting SCM_DO_BUILD_DURING_DEPLOYMENT is false which enables the continuous integration deployment.

For the PowerShell Workaround, refer GitHub Page .

Function App running on Linux OS in consumption plan has limited deployment options but supports only remote build.

To enable remote build on Linux, the following application settings must be set:

ENABLE_ORYX_BUILD=true
SCM_DO_BUILD_DURING_DEPLOYMENT=true

If your project needs to use remote build, don't use the WEBSITE_RUN_FROM_PACKAGE app setting.

Functions Core Tools is the only solution work for me. By default, Azure Functions Core Tool perform remote builds when deploying to Linux. Because of this, it automatically create these settings for you in Azure.

func azure functionapp publish <FunctionAppName>

my custom script file

param(
[Parameter(Mandatory=$True)]
$AppName,
[Parameter(Mandatory=$True)]
$LocalProjectPath
)

cd "$($LocalProjectPath)"

func azure functionapp publish $AppName

cd ..

if you need more help with Linux hosting use this link Zip Deploy.net to get detailed information related to Azure Functions Deployments .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM