Deploy Azure Function App to Linux Consumption Plan

Am I missing something or it is still impossible to deploy to linux consumption plan using Octopus?
Linux consumption plan for functions is GA since August 2019 and according to Microsoft zip deploy is the only way to deploy.
I tried to add WEBSITE_WEBDEPLOY_USE_SCM=false parameter to my function app and use standard “deploy an azure web app” step. It reports successful deployment but there are no functions visible in azure portal.


Unfortunately the built-in Deploy an Azure Web App step can not be used to deploy to Azure Functions using Linux Consumption Plans.

Implementing this in Octopus today would look something like the following:

  1. Add a Run an Azure Powershell Script step, and select your Azure Service principal account
  2. Add your zipped function as a referenced package. When adding the package, set the Extract package during deployment check-box.
  3. The step should be configured to run on a worker pool (or the Octopus server) which has the Azure Functions Core Tools installed.
  4. The script body will look something like below
$appServiceName = $OctopusParameters["AppService"]
$extractedZipPath = $OctopusParameters["Octopus.Action.Package[AzFunc.HelloWorld].ExtractedPath"]

Write-Output "Deploying to app service $appServiceName using file $zipFilePath"

cd $extractedZipPath
func azure functionapp publish $appServiceName --csharp

The above assumes you have a variable AppService which contains the name of the function app service. It also assumes the referenced package you added was named AzFunc.HelloWorld.

The Run an Azure Powershell Script will automatically perform the az login for you.

Because the package is extracted, you can also perform any variable substitution in any files you wish, by enabling the feature in the step using the Configure features button.

The reason I suggest using the func azure functionapp publish ... command is that I wasn’t able to get the az functionapp deployment source config-zip ... command to work reliably, even outside of Octopus. I was regularly getting HTTP 400 errors, but you may have more success.

We do apologize that there isn’t a nicer in-the-box way to accomplish this. We will hopefully improve this story in the near future.

Please reach out if we can help further, or you would like further clarification of anything above.

1 Like

Hi Michael,

Thanks for the workaround, will see if I can get Azure Functions Core Tools installed on the server.

I just tried az functionapp deployment and result was similar to what I get when using built-in Deploy an Azure Web App step - I didn’t get any error, but functions aren’t available after deployment. So functions core tools seem to be the only working method for now.

Looking forward for better way to do it in the future.