Microsoft Azure

This article will show you how to use a Data Connector to integrate with Microsoft Azure by forwarding events to an Azure Function.

Before you begin

  1. You need to have at least Project Administrator level access to a project in Studio.

  2. You need a Microsoft Azure account, which is available with a free trial.

Create an Azure Function

  1. Go to the Azure Portal.

  2. Create a new Azure Function Resource, by navigating to Create a resource, Compute and then Function App.


    In the new view:

      App name: Set to something unique,

      Resource group: Press "Create new", if you don't have one, and enter a name.

      Runtime stack to ".NET Core".

    Press Review + Create, wait for it to finish loading and then press Create.
  3. Expand the notification (“bell”) icon in the top right, and wait until the deployment status says Deployment succeeded.


    Click the Go to resource button.

  4. Click the + next to Functions in the tree listing.


    Select the In-portal option and press Continue.

  5. Select Webhook + API and press Create


  6. Replace the code in the code editor with:

     #r "Newtonsoft.Json"
     using System.Net;
     using Microsoft.AspNetCore.Mvc;
     using Microsoft.Extensions.Primitives;
     using Newtonsoft.Json;
     public static async Task<IActionResult> Run(HttpRequest req, ILogger log)
         string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
         dynamic data = JsonConvert.DeserializeObject(requestBody);
         /* Add further integration code here */
         return (ActionResult)new OkResult();
  7. Click Get function URL


  8. Copy the URL and save this for later.


Create a Data Connector

  1. Go to Studio.

  2. Navigate to the project you want to integrate with.

  3. Open the Data Connector view for the project via the menu on the left.

  4. Click Create new.

  5. Set the Name to “Microsoft Azure”.

  6. Take the URL for the Azure Function, saved previously, and enter this into Endpoint URL.

  7. Set the Data Connector to only send the Touch, Temperature and ObjectPresent events.


  8. Leave everything by default and click SAVE NEW DATA CONNECTOR.

Verify secret

For production code, it is recommended to use the Data Connector “secret” to sign each request and to verify the origin in the receiving code. See, Signing events

Test the integration

To confirm that integration is up and running, we will both look at the Data Connector metrics in Studio and the Azure Function log.

Before proceeding

Make sure your sensors have sent some data by pressing them a few times so that the Data Connector and the Cloud function have run at least once.

Data Connector metrics in Studio

Navigate back to the Data Connector that you created previously in Studio.

At the top of the page, you will find how many times your new Data Connector has been run. data-connector-metrics__3_.png

The Success count shows the number of times the Azure Function has been called and returned HTTP status 200 OK the last 24h.

The Error count shows how many times it has returned an error code or timed out.

Azure Function live log

Navigate to the Azure Function created earlier, open the Logs tab and press Expand.


Interact with any of your sensors and you will see the log being updated in real-time.

Next steps

The next steps are to replace Add further integration code here with code to forward the events into any of Azure’s vast selection of databases, event buses, stream processing or machine-learning tools.