0 0
Disclosure: This page uses affiliate links.When you click an affliate link,we get a small compensation at no cost to you.Thanks for your support!Learn more
Read Time:2 Minute, 55 Second

Serverless services or FaaS like Azure Functions lets you run code without provisioning or managing servers. You pay only for the compute time you consume there is no charge when your code is not running. You can run code for virtually any type of application or backend service all with zero administration. Just upload your code and FaaS provider would take care of everything required to run and scale your code with high availability. You can set up your code to automatically trigger other services or call it directly from any web or mobile app.

You can read more about FaaS or Serverless here.

Step #1.Create Function App

A function app lets you group functions as a logic unit for easier management, deployment, and sharing of resources.

Once you login to Azure Portal,Click the New button on the upper left-hand corner of the Azure portal, then select Compute > Function App.

Microsoft Azure Portal - Click Function App
Image – Microsoft Azure Portal – Click Function App

On the Function app,choose App name,Resource group appropriately

Function App Settings
Image – Function App Settings

The hosting plan defines how resources are allocated to your function app. Default is Consumption Plan, resources are added dynamically as required by your functions.

Subscribe to Emails

More than 100,000 subscribers across the world trust & read Upnxtblog articles. Subscribe to emails updates!
* indicates required

Click on ‘Create’ to create a new function app.

Step #2.Create HTTP trigger function

So now we have a function app, the next step is to create a new function that gets triggered by the HTTP request.

Function app
Image – Function app

On the left-hand side, under the new Functions app, Click on ‘+’ to create new function.

Top online courses in Office Productivity
New Function
Image – New Function

Choose Webhook + API scenario since we are going to create a function based on the HTTP trigger. Appropriate language can be chosen, I’m going ahead with default language CSharp.In the next step, we can write a sample code to print Hello <user>

Step #3.Test HTTP trigger function

Now that a new function is created, we can test it by issuing HTTP request.

Recover over 700 unique file formats. Fully recover documents, emails, photos, videos, audio files and more. Supports 8 different data lost scenarios: deleted files recovery, recycle bin recovery, formatted drive recovery, lost partition recovery, externa

Below is the console where you can modify the code if needed since this is an example, I’m going to the next step. Below code parses query parameter & sets it to a variable then printed.

Code for new Function
Image – Code for new Function

There is an option to test the code inside the console itself.

Test Function
Image – Test Function

Copy the function URL.

Get Function URL
Image – Get Function URL

To the function URL append query parameter &name=<name> and make request to the function.

Test the function from browser
Image – Test the function from browser

Congrats! you have now created a function app that can be triggered by the HTTP request. In the next article, we can check on how to store the requested data on Azure Cosmos DB.

Like this post? Don’t forget to share it!

Additional Resources :

About Post Author

Karthik

Allo! My name is Karthik,experienced IT professional.Upnxtblog covers key technology trends that impacts technology industry.This includes Cloud computing,Blockchain,Machine learning & AI,Best mobile apps, Best tools/open source libs etc.,I hope you would love it and you can be sure that each post is fantastic and will be worth your time.
Happy
Happy
0 %
Sad
Sad
0 %
Excited
Excited
0 %
Sleepy
Sleepy
0 %
Angry
Angry
0 %
Surprise
Surprise
0 %
Summary
Invoke Azure functions using HTTP Trigger
Article Name
Invoke Azure functions using HTTP Trigger
Description
This article explains how to set up your code to automatically trigger from other services or call it directly from any web or mobile app.
Author
Publisher Name
Upnxtblog
Publisher Logo

Average Rating

5 Star
0%
4 Star
0%
3 Star
0%
2 Star
0%
1 Star
0%

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.