Skip to main content
Azure Functions using Node.js, GitHub and DocumentDB

Getting Started with Azure Functions using Node.js, GitHub and DocumentDB

Learn to Code!


Microsoft Azure Functions, a super cool technology introduced by Microsoft, which brings together the code in an event based programming model. If you need to implement a simple integration between your On-Premise or Cloud resources, without having complete service, a simple Azure Function would be the best choice to go for. You can respond to any event with a set of action needs to perform by calling the code from any Azure solution or SaaS product.

With a given choice of using different languages like C#, Node.js , developing the code in the way with your portal experience, makes coding simply fun. Its way easy to integrate with DevOps, the example we will be looking in this tutorial, and very important is, you have to pay only when the code actually runs. Isn’t this sounds interesting? Let’s get our hands dirty and startwith this cool Azure Functions Tech-dose.

Azure Functions using Node.js, GitHub and DocumentDB #azure #microsoft #cloud #nodejs #github #documentdb #azurefunctions Click To Tweet

This article provides a quick and smart high-level overview of Microsoft Azure Functions with a practical example of how to get started with creating an initial Azure Function using Node.js, integrating it with GitHub. Also, we will learn how to integrate an output for Azure Functions, with other Azure SaaS products like DocumentDB (NoSQL).

For novice Cloud Developer, aspiring Cloud architects, Pre-sales consultant and all other IT pros associated with Cloud computing, especially with Microsoft Azure, this tutorial would fairly enough explain the importance and capabilities of Microsoft Azure Functions.

Microsoft Canada Business Solutions

Quick High-level Overview

“A solution for seamlessly running small pieces of code or ‘functions’ in the Cloud is Azure Functions” explains Mathew H, Microsoft. Azure Functions can make development more productive, as is only subject to handle code. For more details read Azure Functions Overview

Key features like choice of coding Language, pay as use model, supporting favorite dependencies libraries using NuGet, integrated security with OAuth providers such as Azure AD, Facebook, Google and other social channels, smooth integrations with Azure SaaS products, Continuous Integrations, and an open source runtime makes Microsoft Azure Functions smart cloud technology to work with.

After praising sessions, let’s start with actually experiencing the same.

Assuming you have Azure Portal Account, if not, Create your free Azure account navigating to this link –

Once you’re done with creating Azure account, let’s begin with creating our first Azure Function.

How to create Azure Functions?

Currently, there are two ways to create Azure Functions.

Azure Functions

Click on New => Web + Mobile => Function App as shown in below image:

Azure Functions

Enter desired Function App name, and other details. Select the storage account (or create a new one) and click on Create.

Azure Functions

Now you will be taken to the Get Started page. Here, you can select to start based on some existing apps or start from scratch or you can import your code if you already have and get started.

Click on New Function to start with.


Creating Azure Functions continued…

After clicking on new function, you will be redirected to the below page with all different Azure Functions templates.

There is a dropdown for Language that you can pick from (Bash, Batch, C#, F#, JavaScript, PHP, Powershell, Python are the different language options available).

There is another dropdown for Scenario (namely Core, API & Webhooks, Data Processing, Experimental, Samples) by which you can filter the templates.

In this example, we will select ‘GitHub Webhook – Node’ template which will be triggered as per event over GitHub takes place. Give some appropriate name to this function and click Create.

As you can see in below image, I am naming the function as ‘fnLogGitHubIssueActivity‘. We will be logging details, when there is any comment being entered to Issue section at GitHub.


Once templates is selected, you will land up to Functions page.

As highlighted in below image, Develop section consist of Function Url & GitHub Secret(Will be using this details for integrating with GitHub).

Code, where desired code needs to be written. It would be populated with some Code which would log the comments and would be seen in Log window. Please refer below screenshot:


Assuming you have your GitHub account, go to GitHub and login.

Navigate to Settings => Webhook & Services tab

Enter Payload URL and Secret key, with Function URL and GitHub Secret key from portal’s Functions window respectively.

GitHub - Azure FunctiionsA

You can select Events for which we need to trigger Azure functions.

Here, we would select ‘Issue comment’ as we need to trigger the functions when someone enters comment to any Issue in GitHub.

Once done click on Add Webhook.


Webhook will be added and it would look like the below screenshot (always verify the URL for safer side)

GitHub - Azure Functions
Microsoft Corporation


Enter comment to Issue listed at GitHub.

The same should get logged in our Azure function window, “Log” section.


Cool its working! Simple, isn’t it?

GitHub - Azure Functions


You would have noticed, till now I haven’t worked upon any development tool like Visual Studio for writing code. Its only the portal which we have used so far, and that’s one among the cool feature of using Azure Functions, simply coding with Azure Portal.

By now, I am sure you would be more familiar with Azure Functions.

Let’s extend our tutorial, by integrating Azure Functions output with other Azure SaaS products.

Considering above tutorial, we can log comments entered in GitHub issue section, in Azure products like Azure Storage Table, Azure DocumentDB (NoSQL).

In this tutorial, I will log comments entered in GitHub to Azure DocumentDB using Azure Functions.

To do this, go to Integrate section in Azure Functions window.

Here, under Outputs, click on ‘New Output’ => Azure DocumentDB Document.

Azure DocumentDB - Azure Functions

Follow the instructions as shown below:

Click on link ‘New’, you will be listed with existing DocumentDB account associated with your Azure account, if any. You can go with selecting existing DocumentDB account or Create New as shown in second image below.

Once account selection is done, final window would appear. Click on Save, and navigate to Develop section in Window.

Azure DocumentDB - Azure Functions


DocumentDB Account Listing.

Azure DocumentDB - Azure Functions


Now in Code section, add highlighted code. This code will add comment to selected DocumentDB document.

You can directly copy below code and paste it (be sure you code correct ‘Document Parameter Name’ present in Integrate window. Here as you can see, this name is outputDocument and the same is added in code section).

context.bindings.outputDocument =
{text: "Comments: '"+ data.comment.body + "'"};



Enter new comment at GitHub Issue thread:

Azure DocumentDB - Azure Functions


And verify the same at our DocumentDB Document Explorer.


Whoa! How seamlessly we created new Azure Function, integrated with GitHub and then easily extended Function output to Azure DocumentDB (NoSQL) Azure SaaS product. Everything in less than 15 mins!

Still, for more technical information about Microsoft Azure Functions, visit developer reference.

Conclusion or Summary

Azure Functions is a super cool solution for processing data, integrating systems, working with the internet-of-things (IoT), along with building simple APIs and microservices.

Would highly recommend Microsoft Azure Functions for performing tasks like image processing, order processing, file repository maintenance, long-running tasks that you want to run in a background thread, or for any schedule tasks.

Hope you would have enjoyed this tutorial, if you have any questions with respect to same or any interesting use-case or suggestion, please do comment below or email.

Knowledge grows by sharing! Don’t forget to share this article, if it would have helped you, it will also help many others too!

Thank You! Happy Azure Coding!

An article by – Kasam reviewed and re-furbished by Team DotNetCrunch

Coursera DS Design 10


Kasam Shaikh

Hello! I am Kasam Shaikh, aspiring Technical Architect, Working as Microsoft CoE .NET, along being part of Research and Development team for Cloud in Hexaware Technologies Ltd. Mumbai, India and responsible for Building Architecture, Supporting RFPs, Client convincing with Technical aspects , Coding , Reviewing, Technical Mentoring to Delivery Teams. . Microsoft Azure, Microsoft Bot Framework, Microsoft Cognitive Systems, Universal Windows Platform Development, Xamarin Forms, MVC, AngularJS and ASP.NET are my core areas of interest. Wanna reach : E-mail me : or Connect with me on LinkedIn: