0% found this document useful (0 votes)
41 views23 pages

Easily Build Serverless API Using Azure Functions

Azure Functions allow you to easily build serverless APIs. Functions scale automatically and only charge when executed. The demo shows how to create an HTTP triggered function in the Azure portal that behaves like a REST API. When the function URL is called, it returns a string parameter. Azure Functions are well-suited for APIs because they can scale automatically and only charge when requests are received.

Uploaded by

Purvang Joshi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views23 pages

Easily Build Serverless API Using Azure Functions

Azure Functions allow you to easily build serverless APIs. Functions scale automatically and only charge when executed. The demo shows how to create an HTTP triggered function in the Azure portal that behaves like a REST API. When the function URL is called, it returns a string parameter. Azure Functions are well-suited for APIs because they can scale automatically and only charge when requests are received.

Uploaded by

Purvang Joshi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 23

Easily build serverless API

using Azure Functions


• Did you know that you can easily create a serverless API with Azure
Function? Each API call is executed by a function that spins up and
scales automatically and you only pay when the function is executed.
• Let’s go ahead and see this step by step demo.
First of all, go to the Azure Portal and create a
function app.
Give basic details. Then for the Runtime stack,
choose .NET version 3.1 and choose a location. Go to
Hosting.
In the Hosting tab, you will see that we will be using the
consumption plan that is serverless. Next go to networking and
skip that tab.
Next in monitoring, disable application insights
and create the function app.
Once the function app gets created, go to it. Here
you can create one or more functions.
Here, click Create.
Choose the development environment as develop in portal.
And for the template, choose HTTP trigger. Next, scroll down.
Next, give name Customer to the function and set the
Authorization level as Anonymous.
If you go to the Integration, you will see that this is the
trigger.
These are called the bindings. The function already behaves
like an API and we can simply customize that behaviour.
• We are going to edit the trigger to do that. In the trigger, we will
create a route template that will behave like a REST API.
Create a route template as customer and click
save.
Here you will see the standard code template for HTTP
trigger.
Add a string parameter in the function and call it below. Then
it will display in the output if the string isn’t empty. Click save.
Click Test/Run.
Add the customer name in the field and click Run.
The output would look something like this. It runs, yay!
Now to test the API, click on the three dots and click
Get Function URL.
Then, copy API URL to the clipboard.
Now when you run it in the browser, it will give you the
desired output.
• Azure functions are very well suited to run APIs at scale because they
can be triggered by http requests, and also because they can scale
automatically. The biggest benefit of them is that when you run them
serverless, you only pay for them when they run. Try this demo out on
your own!

You might also like