Hi
I need to call one function in another function in azure function app using c#.
please help
Hi
I need to call one function in another function in azure function app using c#.
please help
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Mohammad HussainPosted Jul 31, 2023, 2:40 PM
Tahir AnsariPosted Jul 31, 2023, 2:23 PM
Cr BhargaviPosted Jul 31, 2023, 1:36 PM
In Azure Function Apps using C#, you can call one function from another function within the same Function App. You can achieve this by using either a direct method call or by triggering the second function as an HTTP request.Example of calling direct function
public static class MyFunctions
{
[FunctionName("Function1")]
public static void RunFunction1([TimerTrigger("0 */5 * * * *")] TimerInfo myTimer, ILogger log)
{
// Function1 logic here
// Call Function2
Function2();
}
public static void Function2()
{
// Function2 logic here
}
}
Function1is a TimerTrigger function that gets triggered every 5 minutes. InsideFunction1, we callFunction2directly.