Getting Started Azure IoT Data Hub
View the following video for a complete demonstration of how to send live data to Azure IoT Data Hub.
Create an IoT Hub
You need to create an IoT Hub for your device to connect to. The following steps show you how to complete this task using the Azure portal:
Sign in to the Azure portal.
From the left menu, click Create a resource, then click Internet of Things, and then click IoT Hub.
On the Basic tab, enter your Project Details.
In Resource Group, create a new resource group, or select an existing one. For more information, see Using resource groups to manage your Azure resources.
In the IoT Hub Name field, enter a name for your hub. If the Name is valid and available, a green check mark appears in the Name box.
When you have finished entering your IoT hub configuration options, click Review + Create at the bottom of the page. On the next page, review your details and then click Create.
A page will appear that says: Your deployment is underway.
It can take a few minutes for Azure to create your IoT hub. Be patient.
When it is done you will see a page that says: Your deployment is complete. Click the Go to resource button.
The page you now see gives you an Overview of your new IoT Hub. On the top right side of the page, you will see the Hostname for your hub. Copy this somewhere because you will need it later on in the tutorial to set up your OAS driver.
Next click Shared access policies from the left menu. In the pane that appears to the right, click iothubowner.
In the panel that appears to the right, select the Copy to clipboard icon next to Connection string – primary key. Save this as well, you will need it later.
You have now created your IoT hub and you have the hostname and connection string you need to complete the rest of this tutorial.
Create an IoT Driver
Open Configure UDI.
Select Configure >> Drivers from the top menu.
Select your Network Node, either local or remote.
Enter the Driver Interface Name you wish to use.
Select Azure IoT from the Driver combo box.
Enter the Azure IoT Device ID you want to use.
Enter the Connection String from Step 9 of the previous section into the Azure IoT Connection field.
Enter the hostname from Step 8 of the previous section into the Azure IoT Hub URL field.
To enable data buffering when communication failure occurs check Enable Store and Forward. Values will be stored in the directory specified under Configure >> Options >> Store and Forward.
Select the preferred Azure IoT Transport. Typically it is AMQP.
Optionally define a secondary failover IoT Hub URL if the primary server fails with the property Enable Failover.
If both the primary and secondary servers are offline the Return to Online settings determines the retry frequency.
View Driver Interface Failover for more information and and video demonstrating communications failover.
Click Add Driver on the top left.
Publish Live Data to your Azure IoT Hub.
There are 2 ways to publish data from OAS to Azure IoT Hub. Both require Tags to be setup first for the data sources you want to transfer.
Option 1 – Publish Selected Tags to your Azure IoT Hub.
View the following video for a complete demonstration of how to publish data to Azure IoT Data Hub.
Enable Publish Selected Tags at the bottom of the Driver configuration.
Select to publish data continuously at a specified interval, based on event, or at a specific time of day.
If Event Driven browse for a local or remote OAS tag that will trigger the publish. Select a Boolean tag that will change state from false to true, true to false, or both. Or choose an Integer tag that trigger a publish anytime the value changes other than 0.
Enable Publish Latest Value Only to send only the latest value of each tag when published or disable to send all value changes since the last time a publish occurred.
Enabled Include All Tags Each Publish to send at least the latest value of each tag when published or disable to only send the tags that have changed since the last publish.
Enable Publish All Tags As One Topic to publish all tag values as one topic or disable to send each tag as its own topic.
See examples in Step 6 below for each selectable option.
Specify the Publish Topic Id if choosing to Publish All Tags As One Topic.
Specify the Tag Id, Value Id, an optional Quality Id, and Timestamp Id for each tag value that is sent.
When including the Timestamp Id also specify the timestamp format, use Custom to specify your own date and time format.
Specify local and remote OAS tag variables to include in each publish and specify the Id. Value is the current value from the data source or you can select any of the over 600 tag variables of each tag to publish.
Optionally use CSV Export and CSV Import buttons to set up additional tags to publish using Microsoft Excel.
When selecting remote tags use Basic Networking syntax or Live Data Cloud syntax in the tag path.
Select Apply Changes to begin publishing to Azure IoT Hub. Select Save to save the new driver configuration within the tag file.
Examples of publishing every 2 seconds with each tag value changing every second:
Option 2 – Use Data Route to Send Data to Azure IoT Hub
Select Configure >> Tags from the top menu.
Select your Network Node, either local or remote.
From the demo tags select the Ramp Tag.
Select the Target tab.
Enable Write to target.
Select the Azure IoT in the Target Type dropdown.
Select the Driver interface you created.
Apply the Changes and you should now be writing to your IoT Hub.
The message is formatted as follows.