Uncategorized

Azure Functions

Azure Functions is the server less computing service hosted on public cloud in Microsoft Azure.

Generally traditional application development requires consideration of underlying IT infrastructure. For cloud computing, an IT team must create, monitor and pay for cloud computing instances — regardless of how much work that instance actually does for the business.

Function as a service is the idea behind server less computing, it is to eliminate those infrastructure considerations for the user. With server less, a user can simply create and upload code, and then define the triggers or events that will execute the code. Triggers basically comes from a wide range of sources, including other user’s application or any other cloud services, such as databases, events and notification hubs.

Once a trigger or event occurs, it is mainly cloud provider’s responsibility to load all the code into a suitable execution environment, run the code and to release the compute resources. There will be servers involved, but the user no longer needs to provision or manage compute instances. In addition, rather than pay for those compute instances and other associated resources each month, users pay for server less computing based on the amount of time a function runs in a given billing cycle

Create a function app:

  1. Click on New button found on the upper left-hand corner of the Azure portal, then select Compute > Function App.
  • Use function app settings as specified in table below the image.
  • Click on create to provision & deploy the function app.
  • Click on Notification icon in the upper-right corner of portal and watch

for the Deployment succeeded message

  • Click on Go to resource to view new function app.

Trigger Templates

  • HTTP Trigger
  • Time Trigger
  • Queue Trigger
  • Service Bus Queue Trigger
  • Service Bus Topic Trigger
  • Blob Trigger
  • Event Hub Trigger
  • Cosmos DB Trigger
  • IoT Hub (Event hub)
  • IoT Hub (Service Bus Queue)
  • IoT Hub (Service Bus Topic)
  • Generic webhook
  • GitHub Commenter
  • GitHub webhook
  • Http Get
  • Http Post
  • Http Put
  • Http trigger with parameters
  • Scheduled Mail
  • Send Grid
  • Face Locator
  • Image resizer
  • SAS Token Generator
  • Manual Trigger
  • Application insights Http availability
  • Applications insights power BI
  • Application insights scheduled analytics
  • Application insights scheduled digest
  • External file trigger
  • External table
  • Event grid trigger
  • Http post with azure storage queue

Choose template & select language that you wanted to code with.

Creating an Http Function:

Expand your function app & select the + button next to Functions. If it is your first function in function app, select Custom function. This displays the complete set of templates.

In the search, type http and then choose C# for the HTTP trigger template.

Give a Name for the function Name, choose Function for Authentication level, and then select Create.

Replace the contents of the run.csx file with the following code, then click on Save:

To test the function, click Test at the far right to expand the test tab. Enter the following value for the Request body, and then click on Run.

Generate OpenAPI definition

Now you are ready to generate OpenAPI definition. This definition can be used by other Microsoft technologies, like API Apps, PowerApps and Microsoft Flow, as well as third party developer tools like Postman and many packages.

  1. Select on the verbs that your API supports (in this case POST). This makes the generated API definition cleaner.
    1. On Integrate tab of your new HTTP Trigger function, change Allowed HTTP methods to Selected methods
    1. In the Selected HTTP methods, clear all options except POST, then click Save.
  • Click on your function app name (like function-demo-energy) > Platform features > API definition.
  • On the API definition tab, click on Function.
  • This step enables a suite of OpenAPI options for your function app, including endpoint to host an OpenAPI file from your function app’s domain, an inline copy of the OpenAPI Editor, & an API definition template generator.
  • Click Generate API definition template > Save.

Mounika Donthi

You might also like

Leave a Reply

Your email address will not be published. Required fields are marked *