Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Hosted-services / Azure

Azure Functions Tutorial – New Function App

5.00/5 (3 votes)
4 Jul 2016CPOL2 min read 15.7K  
Azure Functions, a new service offered recently by Microsoft, has a huge potential to be a game changer in cloud computing and is especially valuable in implementation of microservices and IoT. This post walks you through the very basic activity of creating a Function App and explores an example.

Creating a New Function App

In this post, we will look at creating a new Azure Function App and explore a provided example.

Let’s start by creating a new Function App and walk through the setup process. (This post assumes you already have an Azure account.)

  1. Add a Function App by clicking on the + icon and searching for Function App.

    Add new azure function

  2. Fill in the details of your new function. Keep in mind that the app name is unique across the namespace, which means, you will not be able to use the same name as I used here in this tutorial.

    Dynamic Pricing

    As of the writing of this post, Dynamic pricing was not available on Microsoft Azure Function Pricing. Make sure you check the pricing page to get the latest update.

    new function create dialog

  3. Once the function app is created and deployed successfully, it will open the function home view.

    function landing view

Now you are ready to experiment with Azure Function App. Go ahead and explore the samples provided.

Here, we are going to examine a sample under Webhook + API scenario using C# as our language.

Select Webhook + API scenario, select C# as the language, then click “Create this function”.

Once the function is created, Azure Portal will open this window:

sample webhook api function

Running the Function

We can run the function online by scrolling down the page to the Run section and test our newly created function and click Run.

This gives us a quick way to test our function to make sure it’s behaving as expected.

Run sample webhook function

Now let us try to invoke this function from Fiddler:

  1. Copy the Function Url from the sample function.

    Image 6

  2. Open fiddler and go to composer, choose POST as the method, paste the Function Url copied earlier.

    It is important to set the content-type to application/json if you are using POST method.

    fiddler_run_function

Now, execute the request and you should get a result of code 200 below showing both raw request and response.

fiddler_run_function_result

Conclusion

In this tutorial, we have seen how to create an Azure Function App, create a sample function and run the function both online and from a desktop application.

What is really significant here is that there was no server to provision, no code to compile and no configurations to enable API endpoint.

Azure Function can play a significant role in a (Micro)service solution focusing on single responsibility and agility in building a robust architecture.

In the upcoming posts, we will take this further in building a real life solution using Azure Function.

Image 9 Image 10 Image 11 Image 12 Image 13

Image 14

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)