Reputation: 3364
I've got a solution that contains a web app and class libraries. I added two Azure function projects to this, the first is version 1 and the second version 2. Both run fine locally. This code is in an online repository (Visual Studio Online, now Azure DevOps), and I set up continuous deployment from it to an Azure function set up in the portal. However, neither project is showing up under Functions in the portal although the code deployed successfully just like Azure websites and the URL says "Your Function App is up and running". I'm using Visual Studio 2017.
Upvotes: 35
Views: 52958
Reputation: 1518
We ran into this problem after the Azure Functions were migrated from in-process model to the isolated worker model.
Solution was to set environment variable FUNCTIONS_WORKER_RUNTIME
to dotnet-isolated
(instead of dotnet
what is was before).
Upvotes: 16
Reputation: 1
Check if the Azure function app name in your pipeline is the same as on the Azure portal. Screenshot description
Upvotes: -1
Reputation: 134
I had the same issue while trying to publish functions from Visual Studio, and in the Azure portal I went to 'Diagnose and solve problems' option and tried the troubleshoot option from there, and it changed the Runtime version of the Function App to ~3 (where it was ~4 before) which resolved my issue.
Upvotes: 1
Reputation: 49
For me this was resolved by using Azure functions v3. Initially I was was not able to see the azure function on the portal, while I was using Azure function v4 (preview version).
Upvotes: 1
Reputation: 31
I was having the same issue with a function not appearing in the Azure portal when deploying directly from Visual Studio. Solution for me was to "Clean" the solution before redeploying.
Upvotes: 0
Reputation: 661
Yet another solution for not showing (deploying) functions - in the CD pipeline "Azure Functions App Deploy", the "Deployment method" was set to "Auto-detect". Changing it to "Zip Deploy" fixed the issue.
What it did technically:
Deleting App Service Application settings. Data: ["WEBSITE_RUN_FROM_ZIP","WEBSITE_RUN_FROM_PACKAGE"]
Updated App Service Application settings and Kudu Application settings.
Package deployment using ZIP Deploy initiated.
When "Auto-detect" was enabled:
Trying to update App Service Application settings. Data: {"WEBSITE_RUN_FROM_PACKAGE":"1"}
Deleting App Service Application settings. Data: ["WEBSITE_RUN_FROM_ZIP"]
App Service Application settings are already present.
Package deployment using ZIP Deploy initiated.
Upvotes: 7
Reputation: 727
While I found @HariHaran's answer helpful, it didn't exactly address my particular problem. Here's the solution I found using a Pre-Compiled Azure function:
npm install
dotnet build
Archive files
Note your root folder structure may be different for the path to your /bin folder. Adjust accordingly.
Azure Function App Deploy
The key here for me was to understand that pre-compiled Azure functions require a specific folder structure, as defined here: https://learn.microsoft.com/en-us/azure/azure-functions/functions-dotnet-class-library#functions-class-library-project. Getting the folder/file structure is necessary to allow your functions to show in the Azure portal.
Therefore my structure in the /wwwroot
folder looked something like this:
| - bin
| - MyFunction
| - host.json
Upvotes: 2
Reputation: 299
When archiving try pointing to publish output folder instead of the root folder. For instance, if the build output folder is set to "publish_output" (--output publish_output --configuration Release)
then try to archive the "publish_output" folder, not the entire root folder.
So that when deploying azure function our source package will have only the published output, not the entire folder. Below is a sample to deploy function app using az.
az functionapp deployment source config-zip -g $rg_name -n "$(fnapp_name)" --src $srcpkgpath
Upvotes: 1
Reputation: 29
I had this same problem with a .Net Framework on Azure Functions version 1. I fixed it by specifying the proper root folder for the zip file creation: bin/release/net471
Upvotes: 1
Reputation: 4099
If you have'nt managed to get CD working, here's the trick. You mentioned that you are using Runtime V2 (.NET CORE ). I have some functions setup in CI/CD as well. In the Build Pipeline
Build you function project with dotnet Build
Task and point it with only the Function project path.
And in the arguments of the task add this
/p:DeployOnBuild=true /p:DeployTarget=Package;CreatePackageOnPublish=true
After the build task, use the Publish Artifact
task by default it outputs eveything to $(Build.ArtifactStagingDirectory)
Now the last step. Use the Azure App Service Deploy
task and Authenticate with your credentials like subscription,RG etc.
Now in the App Service Type
choose FunctionApp on Windows/Linux
( your choice)
Now in the Package or Folder
argument provide $(Build.ArtifactStagingDirectory)/YourFunctionProjectName.zip
This helped me to setup CI/CD for Azure Functions.
Upvotes: 3
Reputation: 3364
Sort of a mess, haven't tested thoroughly, but I managed to deploy it. I deleted the Version 1 Function project, made sure the portal environment was Version 2, disabled continuous deployment, and published manually from Visual Studio. Apart from SCM/Kudu, the folder structure appears to be the same. Not sure which of these did the trick, just glad for now it's working.
Upvotes: 0
Reputation: 1755
I think your function is not getting deployed to the correct path in Azure. Check scm/Kudo to verify if it is deployed correctly.
Upvotes: 1