---
title: Routing Data to Cloud
description: Learn how to connect Blues Notecard applications to third-party cloud services using Notehub Routes and Cellular, Satellite, LoRa, or WiFi connectivity.
source_url: https://dev.blues.io/guides-and-tutorials/routing-data-to-cloud/azure-iot-central/
canonical_url: https://dev.blues.io/guides-and-tutorials/routing-data-to-cloud/azure-iot-central/
markdown_url: https://dev.blues.io/guides-and-tutorials/routing-data-to-cloud/azure-iot-central.md
---

# Routing Data to Cloud: Azure IoT Central

#### Watch a video of this tutorial

[Video: quickstart-step-4.1280w.20260521.mp4](https://dev.blues.io/_media/quickstart-step-4.1280w.20260521.mp4)

In previous tutorials you've learned about the Blues Notecard, and used it to collect data and send it to Notehub, the Blues cloud service.

One powerful feature of Notehub is routes, which allow you to forward your data from Notehub to a public cloud like AWS, Azure, or Google Cloud, to a data cloud like Snowflake, to dashboarding services like Datacake or Ubidots, or to a custom HTTP or MQTT-based endpoint. The tutorial below guides you through sending data to several popular services, and teaches you how to build visualizations using that data.

*Don't see a cloud or backend that you need? Notehub is able to route data to virtually any provider. If you're having trouble setting up a route, [reach out in our forum](https://discuss.blues.com/) and we will help you out.*

## Introduction

*This tutorial should take approximately 30-40 minutes to complete.*

In this tutorial, you'll learn how to connect your Notecard-powered app to **Azure IoT Central**, and learn how to start creating simple visualizations with sensor data.

This tutorial assumes you've already completed the initial [Sensor Tutorial](https://dev.blues.io/guides-and-tutorials/collecting-sensor-data.md) to capture sensor data, saved it in a [Notefile](https://dev.blues.io/api-reference/glossary.md#notefile) called `sensors.qo`, and sent that data through the Notecard to Notehub (or that you've already created your own app with sensor data and are ready to connect your app to external services).

## Create a Route

A Route is an external API, or server location, where Notes can be forwarded upon receipt.

Routes are defined in Notehub for a [Project](https://dev.blues.io/api-reference/glossary.md#project) and can target Notes from one or more [Fleets](https://dev.blues.io/api-reference/glossary.md#fleet) or all [Devices](https://dev.blues.io/api-reference/glossary.md#device). A Project can have multiple routes defined and active at any one time.

Before you create a Route, ensure the data you want to route is available in Notehub by navigating to the **Events** view:

![events view in notehub](https://dev.blues.io/images/guides/route-tutorial/events-view.png?v=e1b03b17)

We'll start with a simple route that will pass Notecard events through to [webhook.site](https://webhook.site), where you can view the full payload sent by Notehub. Using this service is a useful way to debug routes, add a simple health-check endpoint to your app, and familiarize yourself with Notehub's Routing capabilities.

1. Navigate to [webhook.site](https://webhook.site). When the page loads, you'll be presented with a unique URL that you can use as a Route destination. Copy that URL for the next step.

   ![webhook.site service](https://dev.blues.io/images/guides/route-tutorial/webhook-site-url.png?v=5ed567fe)

2. Navigate to the [Notehub.io](https://notehub.io) project for which you want to create a route and click on the Routes menu item in the left nav.

3. Click **Create Route**.

   ![create a route button in notehub](https://dev.blues.io/images/guides/route-tutorial/add-route.png?v=4724c860)

4. Select the **General HTTP/HTTPS Request/Response** route type.

   ![general https request route](https://dev.blues.io/images/guides/route-tutorial/general-route.png?v=b3b8e6a5)

5. Give the route a name (for example, "Health").

   ![name notehub route](https://dev.blues.io/images/guides/route-tutorial/route-name.png?v=9aa60fa8)

6. For the Route **URL**, use the unique URL you obtained from webhook.site.

   ![url for notehub route](https://dev.blues.io/images/guides/route-tutorial/route-url.png?v=449917f5)

7. In the **Filters** section, choose **Selected Notefiles** and check the box(es) next to the Notefile(s) you want to route. For example, we used `sensors.qo` for the sensor tutorial.

   ![choose the notefile to sync](https://dev.blues.io/images/guides/route-tutorial/sensors-qo.png?v=b347af44)

8. Make sure the **Enabled** switch at the top remains selected, and click **Create Route**.

9. Only Notes received *after* the Route is created are routed automatically. If new Notes have been received since you created the Route, proceed to the next step.

   Alternatively, you can **manually route** existing Notes by (1) checking the box next to an event, (2) clicking the **Route** button, and (3) choosing the Route you would like to use:

   ![manually route notes](https://dev.blues.io/images/guides/route-tutorial/manual-route.png?v=904af97c)

10. Return to webhook.site. This page will update automatically with data sent from Notehub. The data from your sensor is contained within the `body` attribute. Notice that Notehub provides you with a lot of information, by default. In the next section, we'll look at using transformations to customize what Notehub sends in a Route.

    ![notehub data in webhook.site](https://dev.blues.io/images/guides/route-tutorial/webhook-site-data.png?v=83ed5ec7)

## Use JSONata to Transform JSON

Before moving on to routing data to an external service, let's briefly explore using JSONata expressions to transform the data Notehub routes.

As mentioned above, Notehub provides a lot of information in each Route request. You may want to trim down what you send to the external service, or you might need to transform the payload to adhere to a format expected by that service. Either way, Notehub supports shaping the data sent to a Route using JSONata.

> **Note:**
>
> To learn more about JSONata later, have a look at the [Blues JSONata Guide](https://dev.blues.io/guides-and-tutorials/notecard-guides/using-jsonata-to-transform-json.md).

### Transform Your Data

Let's try a simple query to the webhook.site Route created in the last section.

1. Navigate to the **Routes** page in Notehub and click on the Route you wish to edit.

   ![view a route](https://dev.blues.io/images/guides/route-tutorial/routes-screen.png?v=0a7ebd91)

2. In the **Transform Data** drop-down, select **JSONata Expression**.

   ![jsonata expression](https://dev.blues.io/images/guides/route-tutorial/jsonata-expression.png?v=98cabc60)

3. In the JSONata Expression text area, add the following query to select the `temp` and `humidity` from the `body`, create a `location` field that concatenates the `tower_location` and `tower_country` fields, and create a `time` field.

   ```json
   {
      "temp": body.temp,
      "humidity": body.humidity,
      "location": tower_location & ', ' & tower_country,
      "time": when
   }
   ```

4. Click **Apply changes**. Then, navigate back to webhook.site. As requests come in, you'll see your custom, JSONata-transformed payload in the Raw Content section.

   ![transformed data routed to webhook.site](https://dev.blues.io/images/guides/route-tutorial/webhook-site-jsonata.png?v=e69aa638)

   > **Note:**
   >
   > The `tower_location` and `tower_country` fields are only populated for events sent over cellular. For Starnote/satellite, LoRa or WiFi devices, those fields will be empty. If you want a single expression that works across connectivity types, use the `best_location` and `best_country` fields instead — Notehub appends those to every event, choosing the most accurate source available (GPS/GNSS, triangulation, or cell tower). See [Data Notehub Appends to Events](https://dev.blues.io/notehub/notehub-walkthrough.md#data-notehub-appends-to-events) to learn more.

JSONata is simple, powerful, and flexible, and will come in handy as you create Routes for your external services. To explore JSONata further, [visit our Blues JSONata Guide](https://dev.blues.io/guides-and-tutorials/notecard-guides/using-jsonata-to-transform-json.md).

## Route to an External Service

Now that you've created your first Route and learned how to use JSONata to shape the data sent by a Route, you can connect Notehub to an external service.

For this tutorial, you'll connect your app to [Azure IoT Central](https://azure.microsoft.com/en-us/products/iot-central), a ready-made UX and API surface for connecting and managing devices at scale, delivering reliable data for business insights.

### Create an Azure Account

If you don't have one already, first create an [Azure account](https://azure.microsoft.com/). Then, log in to your [Azure Portal](https://portal.azure.com/).

### Create an IoT Central Application

1. Once you're logged in, click the **Create a resource** link on the Portal dashboard.

   ![azure create a resource](https://dev.blues.io/images/guides/route-tutorial/azure/portal.png?v=964f06d4)

2. Next, click the **Internet of Things** category and select **IoT Central application**.

   ![azure iot central](https://dev.blues.io/images/guides/route-tutorial/azure/new-iot-central.png?v=89313c8f)

3. On the configuration screen, fill out all of the required fields, keeping in mind the **Resource name** and **Application URL** must be globally unique values. Be sure to choose **Custom application** in the Template drop-down. Finally, click **Review + create**.

   ![azure iot central config](https://dev.blues.io/images/guides/route-tutorial/azure/iotc-config.png?v=29a51878)

4. The resources needed for your IoT Central application will be created in the background. When the deployment complete screen loads, click the **Go to resource** button.

   ![azure deployment complete](https://dev.blues.io/images/guides/route-tutorial/azure/deployment-complete.png?v=4987859e)

5. Next, click on the name of the **resource** you created. On the overview page, you'll see the **IoT Central Application URL** in the top-right corner. Click it to open your IoT Central Application.

   ![IoT central application url](https://dev.blues.io/images/guides/route-tutorial/azure/iotc-url.png?v=69c2f827)

### Create a Notecard Device Template

In order to begin ingesting sensor data into your IoT Central application, you'll need to create a device template.

1. Click the **Device templates** option on the IoT Central menu, and then **Create a device template**.

   ![azure device templates](https://dev.blues.io/images/guides/route-tutorial/azure/iotc-dashboard.png?v=de5717a9)

2. On the next screen, click the **IoT device** custom device tile and click the **Next: Customize** button.

   ![azure iot device template](https://dev.blues.io/images/guides/route-tutorial/azure/iot-device-template.png?v=f2471380)

3. Give the template a **name** and click **Next: Review**.

   ![azure iot device template name](https://dev.blues.io/images/guides/route-tutorial/azure/template-name.png?v=8f96ebe0)

4. On the review screen, click **Create**.

   ![create azure device template](https://dev.blues.io/images/guides/route-tutorial/azure/template-create.png?v=2b0f510a)

5. The primary purpose of the device template is to create a set of interfaces, capabilities, and telemetry that IoT Central uses to describe physical devices that connect to it. As such, the first thing we need to create is a model. Click the **Custom model** tile to create a new model from scratch.

   ![azure create model](https://dev.blues.io/images/guides/route-tutorial/azure/capability-model-create.png?v=0d840a66)

6. Now that you have the model, let's create *capabilities* to represent telemetry data. Specifically, you'll create capabilities for the temperature and humidity values captured from your sensors. Click the **Add capability** link.

   ![add capabilities to model](https://dev.blues.io/images/guides/route-tutorial/azure/add-capability.png?v=1a3200b9)

7. A form will appear on the screen asking for capability details. Enter the following values in the respective fields:

   - Display name: `Temperature`
   - Name: `temp`
   - Capability type: `Telemetry`
   - Semantic type: `Temperature`
   - Schema: `Double`
   - Unit: `Degree celsius`

   ![add temperature telemetry to model](https://dev.blues.io/images/guides/route-tutorial/azure/temp-telemetry.png?v=38a1c842)

8. Click the **Add Capability** button and repeat this process for the humidity capability, using the values below:

   - Display name: `Humidity`
   - Name: `humidity`
   - Capability type: `Telemetry`
   - Semantic type: `Humidity`
   - Schema: `Double`
   - Unit: `Percent`

   When done, click **Save**.

   ![add humidity telemetry to model](https://dev.blues.io/images/guides/route-tutorial/azure/hu-telemetry.png?v=75e0eaed)

9. Finally, you'll need to publish your template so devices can be associated with it. Click the **Publish** link on the top toolbar, and **Publish** again in the confirmation modal.

   ![publish template](https://dev.blues.io/images/guides/route-tutorial/azure/publish-template.png?v=c22486e8)

   ![confirm publish template](https://dev.blues.io/images/guides/route-tutorial/azure/publish-confirm.png?v=db7ec4be)

Now that you have a published template, you are ready to create a *device bridge application* to connect Notehub to your IoT Central Application.

### Configure the IoT Central Device Bridge

The Azure IoT Central Device Bridge is a middleware application that runs in Azure and forwards messages from your IoT devices to your IoT Central app. You can create your own middleware if you prefer, but we recommend the IoT Central Device Bridge because it provides a one-click deployment approach that includes a secure key vault for storing your IoT Central SAS tokens and a simple Node.js application for ingesting data.

1. To create a device bridge instance for your app, visit the [Device Bridge GitHub repository](https://github.com/Azure/iotc-device-bridge) and click the **Deploy to Azure** button.

   ![iot central device bridge on github](https://dev.blues.io/images/guides/route-tutorial/azure/device-bridge-github.png?v=691a9fb8)

2. That link will take you to a **Custom deployment** configuration screen in the Azure Portal, where you'll need to select a **subscription**, **resource group**, and **region** for deployment.

   ![custom deployment config](https://dev.blues.io/images/guides/route-tutorial/azure/deployment-config.png?v=8a036686)

3. Next, you'll need to provide a **Scope ID** and **IoT Central SAS Key** for the middleware application. This allows it to route Notehub data into IoT Central. In a separate tab, return to your IoT Central application and navigate to **Permissions > Device connection groups**. Copy the **ID scope** value and paste it into the **Scope ID** field on the **Custom deployment** screen.

   ![scope id](https://dev.blues.io/images/guides/route-tutorial/azure/scope-id.png?v=a17d33be)

4. Now, click on the **SAS-IoT-Devices** enrollment group in the **Device Connection** setting screen of your IoT Central app. Copy the **SAS Primary Key** and enter it into the **IoT Central SAS Key** field on the **Custom deployment** screen.

   ![sas token](https://dev.blues.io/images/guides/route-tutorial/azure/sas-token.png?v=5301ce62)

5. After you've added all of the required fields on the **Custom deployment** screen, click **Review + create**. Then, click **Create** on the next screen.

   ![review and create custom deployment](https://dev.blues.io/images/guides/route-tutorial/azure/middleware-create.png?v=9fd563a7)

6. The deployment will take a few moments, during which time you'll see **Deployment is in progress** on the overview page. Once the deployment completes, click the **Go to resource group** button.

   ![deployment in progress](https://dev.blues.io/images/guides/route-tutorial/azure/deployment-underway.png?v=a0d2a947)

7. Now you'll need to open the **Function App** created during the previous step and install a number of dependencies. On your resource group dashboard, find your Function App and click its name to load it (you may have to click the **Refresh** button to see it).

   ![function app](https://dev.blues.io/images/guides/route-tutorial/azure/function-app.png?v=67fdcf6d)

8. In the left menu, find the **Development Tools** group and click the **Environment variables** menu item. Click the `WEBSITE_NODE_DEFAULT_VERSION` variable and change the value to `~20` (reflecting the version of Node.js you want to use). Be sure to **Apply** any changes made.

9. Remaining in the **Development Tools** group, click the **Console** menu item. This will load a sandboxed console environment in the browser.

10. At the prompt, type the following to install your application:

    ```bash
    cd IoTCIntegration && npm install
    ```

    *Note: The process will take a few moments to complete and you may see a few warnings.*

11. After the installation finishes, restart the Function App by clicking the **Restart** button on the Overview page.

    ![restart function app](https://dev.blues.io/images/guides/route-tutorial/azure/restart-app.png?v=39a83321)

12. Finally, you'll need the **Function URL** of your Function App in order to create a Route in Notehub. On your Function App dashboard, click the **Functions** menu item, then the name of your Function. Click the **Get Function Url** button on the top menu and copy the **default (Function key)** URL for the next step.

    ![get the function url](https://dev.blues.io/images/guides/route-tutorial/azure/function-url.png?v=6dd75278)

### Create a Route in Notehub

With your IoT Application set up and middleware configured, the next step is to create a Route in Notehub.

1. Navigate to your project at [Notehub.io](https://notehub.io).

2. Open the Routes dashboard in Notehub and click the **Create Route** button.

   ![create route in notehub](https://dev.blues.io/images/guides/route-tutorial/add-route.png?v=4724c860)

3. Select **Azure** as the route type.

   ![create azure route](https://dev.blues.io/images/guides/route-tutorial/azure/select-azure.png?v=6b74eb50)

4. Give the route a name in the **Name your route** field.

5. Set your route's **Type** to **Function**, then set the **URL** to the Azure Function App URL that you copied earlier.

   ![azure function url](https://dev.blues.io/images/guides/route-tutorial/azure/paste-function-url.png?v=73eedcb7)

   > **Note:**
   >
   > **Routing Data to an Azure Function Secured by a Secret Key?**
   >
   > If you need to create a Route against an Azure Function [secured by a secret key](https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-http-webhook-trigger?tabs=csharp#authorization-keys), first change your route **Type** to **Function (Secret Key)**, and then provide [your function key from the Azure portal](https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-http-webhook-trigger?tabs=csharp#obtaining-keys) in the **Secret Key** field.
   >
   > ![Azure Route Options](https://dev.blues.io/images/guides/route-guides/azure-func-options.png?v=8b9d3847)

6. For the Notefiles field, select the **Selected Notefiles** option and choose `sensors.qo`.

7. For the **Transform JSON** field, select **JSONata Expression**. Enter the following transformation in the textarea, which formats the incoming Note to conform to a structure that Azure IoT Central expects. Note that the `timestamp` field is used to align the data ingested to IoT Central with the time it was captured on the Notecard, not when it was routed. After adding this expression, click **Create Route**.

   ```json
   {
     "device": {
       "deviceId": device
     },
     "measurements": {
       "temp": body.temp,
       "humidity": body.humidity
     },
     "timestamp": $fromMillis(when * 1000)
   }
   ```

8. Navigate to the Events page, and wait for a sensor event to show up from your device. Once it does, click on the event, then the **Route log** tab to make sure everything is properly configured. If route log shows a status of `200`, then you are ready to move onto the final step: approving your Device in the IoT Central app.

   ![notehub route log](https://dev.blues.io/images/guides/route-tutorial/azure/route-log.png?v=e442e1c4)

   > **Note:**
   >
   > Remember, if you don't have any new Notes coming in to Notehub, you can always **manually route** existing Notes by (1) checking the box next to an event, (2) clicking the **Route** button, and (3) choosing the Route you would like to use.

### Approve Device in IoT Central

If events are making it from the device bridge to your IoT Central app, the last step is to approve your device and associate it with your template.

1. On the Overview page for your IoT Central app resource, you'll see the **IoT Central Application URL** in the top-right corner. Click it to open your IoT Central Application.

   ![open the iot central app](https://dev.blues.io/images/guides/route-tutorial/azure/iotc-url.png?v=69c2f827)

2. Click on the **Devices** item in the left navigation. You should see your Notecard as an **Unassigned** device under the **All devices** view.

   ![notecard unassociated device](https://dev.blues.io/images/guides/route-tutorial/azure/all-devices.png?v=67ef5d03)

3. Select your device and click the **Migrate** menu item above the device list.

4. In the modal window, click the **Blues Notecard** device template and click **Migrate**.

Your Notecard is now fully connected to your IoT Central application! Now, let's create some dashboards to visualize sensor data.

> **Tip:**
>
> To debug a route or inspect the exact request Notehub sends to your third-party service, open an event in Notehub, click **Route as cURL**, and choose the appropriate HTTP-based route. The modal shows a cURL command that reproduces the same request Notehub makes, with secrets (API keys, passwords, etc.) replaced by placeholders.
>
> ![view curl request from route](https://dev.blues.io/images/guides/route-tutorial/event-route-curl.png?v=22e6a261)

## Build Data Visualizations

Once you've connected your Notecard to IoT Central, you'll want to confirm that the telemetry interfaces you set up are being captured correctly.

1. In your IoT Central application, click on the **Devices** menu item and open your device.

2. You'll be presented with the **Raw data**, or a list of events ingested into IoT Central. If you see values under the **Humidity** and **Temperature** columns, you're ready to create some visualizations!

   ![raw data in iot central](https://dev.blues.io/images/guides/route-tutorial/azure/raw-data.png?v=97071d59)

   > **Note:**
   >
   > If those sensor values are showing up in the **Unmodeled data** column, make sure that the field names in your Notehub Route match the telemetry names you configured in your IoT Central device template.

### Create a Device Dashboard

Let's add a simple line chart to show historical readings, over time, on the default device dashboard provided.

1. Click on **Dashboards**, then click the **Edit** link on the dashboard.

   ![edit dashboard](https://dev.blues.io/images/guides/route-tutorial/azure/new-dashboard.png?v=b90de2ea)

2. In the **Add a tile** menu, click to **Start with devices**. Choose your device group and your device(s).

   ![start with devices](https://dev.blues.io/images/guides/route-tutorial/azure/select-device.png?v=17e9b422)

3. In the **Telemetry** section, select **Humidity** and then **Temperature**. Finally, click the **Add tile** button.

   ![humidity and temperature](https://dev.blues.io/images/guides/route-tutorial/azure/add-tile.png?v=2efa9c29)

4. After adding the tile, a simple graph tile will appear on the far right of the dashboard. Note that you may need to edit the tile and choose a more appropriate **Display range** to see all of your sensor data.

   ![simple tile](https://dev.blues.io/images/guides/route-tutorial/azure/simple-tile.png?v=8c8e5ece)

5. Click the box icon on the chart and select **3 x 3** to increase the chart size.

   ![increase size of chart](https://dev.blues.io/images/guides/route-tutorial/azure/increase-size.png?v=dea5edf7)

6. Click the pencil icon to edit the chart configuration. If you want, you can change the **title** and set **custom colors** for each sensor. When finished, click the **Update** button.

   ![configure chart](https://dev.blues.io/images/guides/route-tutorial/azure/edit-chart.png?v=69bc8553)

7. Click the **Save** button to save your dashboard. As readings come in from your Notecard, the graph will update automatically.

   ![final chart display](https://dev.blues.io/images/guides/route-tutorial/azure/final-chart.png?v=0b297572)

### Show the Last Known Value in a Tile

A graph is useful for viewing data over time, but it's often helpful to also have a view of the last known sensor values. In this section, we'll add tiles to show the last known temperature and humidity values.

1. If not currently editing your dashboard, click the **Edit** button to enter edit mode. Just like before, in the **Add a tile** section, click **Start with devices**. Choose your device group and your device(s).

   ![start with devices](https://dev.blues.io/images/guides/route-tutorial/azure/select-device.png?v=17e9b422)

2. In the **Telemetry** section, select **Humidity** and click the **Add tile** button.

   ![add humidity tile](https://dev.blues.io/images/guides/route-tutorial/azure/last-known-value.png?v=6a9a9d5e)

3. Change the tile type to **Last Known Value** by clicking on the ruler button.

   ![change to last known value](https://dev.blues.io/images/guides/route-tutorial/azure/last-known-value-change.png?v=a80753a2)

4. Repeat this same process for the **Temperature** reading.

5. Click **Save** and revel in your data visualization skills!

   ![final azure dashboard](https://dev.blues.io/images/guides/route-tutorial/azure/final-dashboard.png?v=f993b770)

## Next Steps

**Congratulations!** You've created your first Route and connected your Notecard app to an external service. If you're following a Cell+WiFi Quickstart, you're done!

Now that you know the basics of how Notecard and Notehub work, you’re ready to apply what you’ve learned towards a real project. We have a few recommendations on what to do next:

- [**Learn Best Practices for Production Projects**](https://dev.blues.io/guides-and-tutorials/best-practices-for-production-ready-projects.md): This skimmable guide has a list of best practices for moving your project from a prototype to a real, production-ready deployment.

- [**Browse Example Apps**](https://dev.blues.io/example-apps.md): Our collection of IoT apps that show how to build common projects with Blues. These example apps include dozens of [official Blues project accelerators](https://dev.blues.io/example-apps/accelerators/) and a collection of [purpose-built sample apps](https://dev.blues.io/example-apps.md).

- [**Follow the Notehub Walkthrough**](https://dev.blues.io/notehub/notehub-walkthrough.md): Learn how to manage projects and device fleets, update Notecard and host firmware, set up alerts, securely route your data, and more.

At any time, if you find yourself stuck, please reach out on the [community forum](https://discuss.blues.com/).
