In this post we’d have a quick look at the Azure Functions
Azure Functions can be simply defined as – Code and Event. Basically, we’d have an event on which our code will execute. We can create a function pipeline wherein one function acts as a trigger to another function which then triggers the next action passing the corresponding output.
Azure Functions are easy to write, we can write them inside our Azure Portal or can write in them using command line tooling or Visual studio and easily upload them.
They can be easily bind to existing services like SendGrid, OneDrive, DropBox etc.
And the most important aspect is the Pay only for what you use. Azure Functions comes with monthly free grant of 1 million requests and 400,000 GB-s of resource consumption per month.
The easiest way to try our Azure Functions is to go to Azure Functions Portal
Click on Try It For Free (this doesn’t require setting up Azure Trial or using our existing Azure Subscription).
However, this trial is just for 1 hour.
We’d select Web Hook + API as our scenario and C# as our language and click on create this function.
It will ask as us to choose an auth provider.
After successful authentication, we are presented with the function editor page
We have the function with the below sample code already configure for us. It basically looks for name parameter in either as query parameter or request body and append Hello to it as response.
Click on Run to test it.
Below we have passed Nishant Rana as the value for the query parameter name.
Clicking on the Get Function URL provides us with the url of this particular Funtion.
We can test it in browser or can use any of the extensions like Postman, Advanced Rest Client etc.
View files shows us all the files
Clicking in Integrate presents us with the option to configure the trigger for the function as well as option to define output for it
We can update our Azure Function to update only the Post request as show below.
We can define an output for this function by clicking on New Output.
As we are using free account we’d see many of the options disabled.
Manage section shows us the Key associated for this function.
It is the same key that is being used in the function url
To add a new function we can click the plus button.
Below are the different Function Template that are available.
Again, we have most of the options disabled as we are using free account.
As a next step, we’d create a free Azure account and create function that does something more meaningful.
Hope it helps..