Saturday, 17 February 2018

Basics of Azure Function | App Service | PAAS


In this article, we will see how to accomplish a simple scheduler type of task in azure using Azure Function.

Lets create a Function App from Azure; New->Function App and then provide the function details and choose the Hosting Plan either a consumption plan or App Service Plan depending on the requirement.

From quick start, choose Timer and C sharp as the programming language.

Sample timer function code is generated. Under the function, we can see Integrate and Manage and Monitor tabs.

Integrate option can be used to define Input and Output type of function; thus this allows us to integrate with different azure services like event-hub, logic app, service bus and etc.
Monitor tab provides the log details of each executions, as shown above.

Lets create a console application, This can contain any business logic like generating a session variable or clean up or re-conciliation activity. For our purpose, lets keep it simple, our console which reads a value from config file.

Lets add log4net for logging traces inside console as shown.


Now, lets add another function under the Function App, then upload the log4net and console exe and finally lets invoke to exe using from the function Run method as shown below.
Function executes every minute based on CRON expression and thus log files are generated and can be seem in the function drive.
Logs of function can be seen in the log pane.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.