2
votes

How does Function App detects if a folder contains Functions?

As an incentive for the upcoming Azure Function Tools for VS, I followed the article here: https://blogs.msdn.microsoft.com/appserviceteam/2017/03/16/publishing-a-net-class-library-as-a-function-app/

I have successfully created Azure Function as a web-app project in Visual Studio, deployed the Function App using ARM template, then deployed the Functions using release step in Visual Studio Team Services.

Here are the contents of my Web App project, 'CustomerERPChange' is the Function that I want to get it showing in Azure.

Web App Project

What I'm expecting to see is the Function appearing in the Function App, but that doesn't seem to be the case..

Looking at Kudu I can confirm that the content of my project has been successfully deployed to the ../wwwroot directory, renaming the 'run.cs' back to 'run.csx' also didn't help.

Any idea and suggestion would be appreciated, thanks!

1
Heya all, I've found the solution for this issue by manually publishing from VS (ie right clicking on the Visual Studio Project and choose Publish). If you have any other way around this issue I'd like to hear from you as well :)! - Harris K.
First => Have you publiched the project?, if yes, second => add code of function.json file here., and run.csx also. - Nirav Madariya
and yea, there's another way to create function, from Kudu => from Nav, go to Debug console=> Powershell => create a folder => add function.json and run.csx file, you are good to go! - Nirav Madariya
Hey Nirav thanks for your reply, yeah I figured out that the problem was because I didn't publish the Functions as web app project from Visual Studio, doing so must have registered the Functions to the Function App. - Harris K.

1 Answers

0
votes

There are two ways to create function within Functions App,

1) using UI Create function with template of your choice,

2) from KuDu portal, go to your_app_name.scm.azurewebsites.net,
create a folder in home > site > wwwroot > (function_name),
add run.csx or run.ps1, and function.json file to the newly created folder.

About these files :
run.csx or run.ps1 is a file which will automatically gets called when the function is executed.
function.json is a file which defines your function(either it is a timer or HttpTrigger, or other).