Getting Started for Customers of PTC ThingWorx Cloud Services
If you are setting up the ThingWorx Azure Industrial IoT (IIoT) OPC UA integration on your own, go to the topic,
Step 1. Required Resources.
If you are a PTC ThingWorx Cloud Services customer, you can skip most of the installation, configuration, and deployment information in this section of the help center. However, you are responsible for connecting your edge devices to the Azure IoT Hub. To connect an IoT Edge device to the IoT Hub, a "device twin" must be created on the IoT Hub. Since PTC Cloud Services cannot provide you access to the Azure Portal, the "device twin" must be created using the Microsoft Azure CLI or Microsoft Visual Studio Code.
If you have not already, you should get to know ThingWorx Composer and ThingWorx Mashup Builder through the ThingWorx Platform 9 Help Center:
◦
Programming for the IoT — With ThingWorx you can build solutions using ThingWorx Composer and ThingWorx Mashup Builder. This section of the ThingWorx Platform 9 Help Center will help you understand the ThingWorx concepts and modeling of devices, referred to as "Things". This section links you to ThingWorx
Analytics, which provides tools to embed advanced analytics into your smart, connected solutions.
•
Mashup Builder — This section provides a wealth of information about building Web page visualizations that can deliver information from your ThingWorx OPC UA Industrial Connections. If you want to develop a UI for monitoring your OPC UA endpoints and devices, read this section as you experiment with this powerful tool.
Here are some general references for setting up IoT Edge devices and Edge modules in Azure IoT:
To create IoT Edge Devices and the IoT Edge Runtime, follow the steps in the next section.
Onboarding New IoT Edge Devices and the IoT Edge Runtime Device for Customers of PTC Cloud Services
As part of their deliverables, PTC Cloud Services provides you with an iothubowner connection string. It is up to you to create new IoT Edge Devices and set up the IoT Edge Runtime. The connection string contains all of the information you need to complete onboarding and comes in the following format:
HostName=<IOT_HUB_NAME>.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=<ACCESS_KEY>
|
You must enter both the name of your IoT Hub, (<IOT_HUB_NAME> as shown in the connection string and the entire connection string, from HostName= through <ACCESS_KEY> when running the Azure CLI commands in the steps below.
|
To perform the IoT Edge Device onboarding operations, follow these steps:
2. To create a new Azure IoT Edge device on the IoT Hub, enter the following version of the az iot hub device-identity create command in the Azure CLI:
az iot hub device-identity create --device-id "<DESIRED_DEVICE_NAME>" --hub-name "<IOT_HUB_NAME>" --edge-enabled --login "<IOTHUBOWNER_CONN_STRING>”
Where
◦ <DESIRED_DEVICE_NAME> is the name to use for your IoT Edge device.
◦ <IOT_HUB_NAME> is the name of your Azure IoT Hub.
◦ <IOTHUBOWNER_CONN_STRING> is the iothubowner connection string provided by PTC Cloud Services. This connection string is needed to log in to Azure IoT to create the device.
3. Enter the following command in the Azure CLI and copy the JSON output to a file to be edited in the next step:
az iot hub device-twin show --device-id "<DESIRED_DEVICE_NAME>" --hub-name "<IOT_HUB_NAME>" --login "<IOTHUBOWNER_CONN_STRING>"
4. Open the file containing the JSON output, add the following name value pair, and save the changes:
"tags": {
"__type__": "iiotedge",
"os": "Linux"
}
5. Enter the following command in the Azure CLI, passing in the name of the file containing the updated JSON:
az iot hub device-twin replace --device-id "<DESIRED_DEVICE_NAME>" --hub-name "<IOT_HUB_NAME>" --login "<IOTHUBOWNER_CONN_STRING>" --json <UPDATED_JSON>
6. To retrieve the connection string for the newly created device, enter the following version of the az iot hub device-identity show command in the Azure CLI:
az iot hub device-identity connection-string show --device-id "<DESIRED_DEVICE_NAME>" --hub-name "<IOT_HUB_NAME>" --key-type primary --login "<IOTHUBOWNER_CONN_STRING>"
Where
◦ <DESIRED_DEVICE_NAME> is the name to use for your IoT Edge device.
◦ <IOT_HUB_NAME> is the name of your Azure IoT Hub.
◦ <IOTHUBOWNER_CONN_STRING> is the iothubowner connection string provided by PTC Cloud Services. This connection string is needed to log in to Azure IoT to retrieve the connection string for the new device.
8. Follow the Microsoft instructions,
Verify successful configuration located
here.
This completes the setup of your IoT Edge Device and IoT Edge Runtime.
What's Next?
You need to log in to ThingWorx Composer and follow these instructions: