Azure Function (REST API for Http Trigger & using Timer Trigger with Azure Data Factory)

Anonymous
2021-11-10T21:58:45.04+00:00

I am trying to develop an Azure Function and came across a question regards to the requirement for using HTTP Trigger.

I am trying to pull data using a third party's SDK, and it is XML-based web services (XML API), not REST API, so it appears that I cannot use HTTP Trigger.

1) My understanding is, in order to use HTTP Trigger, I need to have REST API, correct? How about XML API?

I am trying to go with Timer Trigger and use Azure Data Factory to pull data.

2) If I use Timer Trigger and Azure Data Factory (ADF), where does data get stored in between?

Is data stored in the storage account (Table or Blob) that I configured when I created Function App, and then when I execute ADF, data would be pulled from there?
And if so, how does data in the storage account gets truncated (for next run) after it is used?

3) I am trying to locate where the logic of pulling data should go within the Function CS file.

I guess I have to call a method from other cs file (ListVendors.cs) inside the Function app solution to list vendors' data, correct?

And the Main class is in another cs (Program.cs) file.

Do I call/put the class name (& method) inside the Function class inside Run method (as shown below)?

148285-image.png

148277-image.png

148237-image.png

I am trying to understand how Function app gets called vs. how Main method is called within Function application.

4) When I run the solution, how does solution know which file to run (Function file or Main method within the solution)?
Since this is Function solution, I am not sure how execution of solution works.

Thanks.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,461 questions
0 comments No comments
{count} votes

Accepted answer
  1. Jaliya Udagedara 2,736 Reputation points MVP
    2021-11-10T22:49:34.393+00:00

    1) My understanding is, in order to use HTTP Trigger, I need to have REST API, correct? How about XML API?
    2) If I use Timer Trigger and Azure Data Factory (ADF), where does data get stored in between?
    3) I am trying to locate where the logic of pulling data should go within the Function CS file.

    I am sorry, it seems to me that you are in a bit of a misunderstanding.

    In Azure Functions, Triggers are what cause a function to run. A trigger defines how a function is invoked and a function must have exactly one trigger.
    For example,

    • If your function is an HTTP Trigger function, your function can be invoked by sending a HTTP Request.
    • If your function is a Timer Trigger function, you can specify a CRON expression (for example, every 5 minutes, every day at 5 am, etc), and based on the expression, your

    function will get automatically invoked.

    Inside the Function class, you will have a method called Run, there you can put your logic like what to do when the function is invoked. For example, in your case call an external endpoint, it doesn't have to be a REST endpoint.

    A very important thing: the storage account that gets created as part of Function App creation, shouldn't be used for your business logic. It's for function apps' use like maintaining state etc.

    1 person found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. Pramod Valavala 20,601 Reputation points Microsoft Employee
    2021-11-20T12:04:47.22+00:00

    @KingJava To elaborate a bit more for others coming across this post

    1) My understanding is, in order to use HTTP Trigger, I need to have REST API, correct? How about XML API?

    Nope. XML vs JSON is just the payload format. The underlying protocol would still be HTTP.

    2) If I use Timer Trigger and Azure Data Factory (ADF), where does data get stored in between?

    After fetching the data, it would be in memory for a bit while you send it over to ADF.

    3) I am trying to locate where the logic of pulling data should go within the Function CS file.

    Like Jaliya mentioned, its usually the Run method but the main requirement is the FunctionName attribute which registers the function.

    As for how you would want to move the data itself, you would just use regular C# code and relevant SDKs as required. One thing you might want to consider is the function timeouts enforced based on the plan you are running on.

    1 person found this answer helpful.
    0 comments No comments

  2. Aakash Patro 1 Reputation point
    2022-09-15T06:57:21.43+00:00

    Hi @Pramod Valavala . i wanted to know how create a authetication for calling rest api to adf i.e. pipeline().createRun().
    Because we have an azure resource manager library that handles adf requests.
    how make the authentication for the rest call.

    Its like
    azure fn -> rest call -> adf createrun;