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://docs.microsoft.com/en-us/azure/azure-functions/deployment-zip-push
any help would be appreciated.
Thanks
CodePudding user response:
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, i.e., 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.
CodePudding user response:
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 Deploymnet to get detailed information related to Azure Functions Deployments.