Connect Azure IoT Devices Part 2
Step 7: Set-up and Run Demo
The ThingWorx Azure IoT Connector download includes a Java application that simulates a device connecting to your Azure IoT Hub. A ThingTemplate is also included and can be imported into ThingWorx.
Import Demo Templates
In ThingWorx Composer, click Import/Export menu, then click From File and browse to ../demo/edgedevice- demo/platform/entities/CPUDemo_AllEntities.xml

- Click Import then click Close when the import successful message is displayed.
- Create a new Thing using the imported template azureDemo1, enter a name for your Thing and click Save.
NOTE: You will enter this name in the demo config file in the next step.
Configure Demo Application
- In the ../demo/edge-device-demo/conf subdirectory, open the edge-device.conf file with a text editor.
- Edit the deviceId to be the name of the Thing you created in step 3.
- Edit the iotHubHostName to use the name of your hub plus the domain: azure-devices.net. For example, sample-iot-hub.azuredevices.net.
- Edit the registryPolicyKey property to use the Primary Key for the registryReadWrite policy in the Azure IoT Hub.
Below is an example configuration:
azure-edge-device {
deviceId = "alstestedgething"
iotHubHostname = "alsiot.azure-devices.net"
registryPolicyName = "registryReadWrite"
registryPolicyKey = "pzXAi2nonYWsr3R7KVX9WuzV/1234567NZVTuScl/Kg=" }Run Demo Script
- Open a shell or Command Prompt, set the EDGE_DEVICE_DEMO_OPTS environment variable to refer to the file you just edited:
- Linux - export EDGE_DEVICE_DEMO_OPTS="-Dconfig.file=../conf/edge-device.conf"
- Windows - set EDGE_DEVICE_DEMO_OPTS="-Dconfig.file=../conf/edge-device.conf"
- Launch the demo from the ../demo/edge-device-demo/bin subdirectory, using the edge-device-demo command.
- Return to the ThingWorx Composer and open the Properties page of the Azure Thing that you created previously.
- Click the refresh button to see the properties change every five seconds.
- Open the azure-iot-demo Mashup and view the Load Average and CPU gauges, and the increases in the values of the Cycle and Uptime fields.
NOTE: If the edgedevice-demo is running on Windows, the Load Average does not register.
Step 8: Next Steps
Congratulations! You've successfully completed the Connect Azure IoT Hub to ThingWorx Quickstart. By following the steps in this lesson, you imported a device created in Azure into ThingWorx and saw how data from an Azure device could be used in a ThingWorx Mashup.
Learn More
We recommend the following resources to continue your learning experience:
Capability Guide
| Connect | Choose a Connectivity Method |
| Build | Design Your Data Model |
| Experience | Create Your Application UI |
Additional Resources
If you have questions, issues, or need additional information, refer to:
| Community | Developer Community Forum |
| Support | Getting Started with ThingWorx |

