You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/digital-twins/how-to-ingest-opcua-data.md
+49-49Lines changed: 49 additions & 49 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,9 +3,9 @@
3
3
title: Ingest OPC UA data with Azure Digital Twins
4
4
titleSuffix: Azure Digital Twins
5
5
description: Steps to get your Azure OPC UA data into Azure Digital Twins
6
-
author: danhellem
7
-
ms.author: dahellem# Microsoft employees only
8
-
ms.date: 06/21/2022
6
+
author: baanders
7
+
ms.author: baanders# Microsoft employees only
8
+
ms.date: 10/4/2022
9
9
ms.topic: how-to
10
10
ms.service: digital-twins
11
11
# Optional fields. Don't forget to remove # if you need a field.
@@ -74,7 +74,7 @@ If you already have a physical OPC UA device or another OPC UA simulation server
74
74
75
75
The Prosys Software requires a simple virtual resource. Using the [Azure portal](https://portal.azure.com), [create a Windows 10 virtual machine (VM)](../virtual-machines/windows/quick-create-portal.md) with the following specifications:
76
76
***Availability options**: No infrastructure redundancy required
77
-
***Image**: Windows 10 Pro, Version 2004 - Gen2
77
+
***Image**: Windows 10 Pro, Version 21H2 - Gen2
78
78
***Size**: Standard_B1s - 1 vcpu, 1 GiB memory
79
79
80
80
:::image type="content" source="media/how-to-ingest-opcua-data/create-windows-virtual-machine-1.png" alt-text="Screenshot of the Azure portal, showing the Basics tab of Windows virtual machine setup." lightbox="media/how-to-ingest-opcua-data/create-windows-virtual-machine-1.png":::
@@ -122,17 +122,17 @@ In this section, you set up the OPC UA Server for simulating data. Verify that y
122
122
123
123
In this section, you'll set up an IoT Hub instance and an IoT Edge device.
124
124
125
-
First, [create an Azure IoT Hub instance](../iot-hub/iot-hub-create-through-portal.md). For this article, you can create an instance in the **F1 - Free** tier.
125
+
First, [create an Azure IoT Hub instance](../iot-hub/iot-hub-create-through-portal.md). For this article, you can create an instance in the **F1: Free** tier (if you're using the Azure portal to create the hub, that option is on the **Management** tab of setup).
126
126
127
127
:::image type="content" source="media/how-to-ingest-opcua-data/iot-hub.png" alt-text="Screenshot of the Azure portal showing properties of an IoT Hub.":::
128
128
129
-
After you've created the Azure IoT Hub instance, select **IoT Edge** from the instance's left navigation menu, and select **Add an IoT Edge device**.
129
+
After you've created the Azure IoT Hub instance, select **IoT Edge** from the instance's left navigation menu, and select **Add IoT Edge Device**.
130
130
131
131
:::image type="content" source="media/how-to-ingest-opcua-data/iot-edge-1.png" alt-text="Screenshot of adding an IoT Edge device in the Azure portal.":::
132
132
133
133
Follow the prompts to create a new device.
134
134
135
-
Once your device is created, copy either the **Primary Connection String** or **Secondary Connection String** value. You'll need this value later when you set up the edge device.
135
+
Once your device is created, copy either the **Primary Connection String** or **Secondary Connection String** value. You'll need this value in the next section when you set up the edge device.
136
136
137
137
:::image type="content" source="media/how-to-ingest-opcua-data/iot-edge-2.png" alt-text="Screenshot of the Azure portal showing IoT Edge device connection strings.":::
138
138
@@ -147,70 +147,70 @@ In this section, you set up IoT Edge and IoT Hub in preparation to create a gate
147
147
148
148
To get your OPC UA Server data into IoT Hub, you need a device that runs IoT Edge with the OPC Publisher module. OPC Publisher will then listen to OPC UA node updates and will publish the telemetry into IoT Hub in JSON format.
149
149
150
-
#### Create Ubuntu Server virtual machine
150
+
#### Create Ubuntu VM with IoT Edge
151
151
152
-
Using the [Azure portal](https://portal.azure.com), create an Ubuntu Server virtual machine with the following specifications:
153
-
***Availability options**: No infrastructure redundancy required
154
-
***Image**: Ubuntu Server 18.04 LTS - Gen1
155
-
***Size**: Standard_B1ms - 1 vcpu, 2 GiB memory
156
-
- The default size (Standard_b1s – vcpu, 1GiB memory) is too slow for RDP. Updating it to the 2-GiB memory will provide a better RDP experience.
157
-
158
-
:::image type="content" source="media/how-to-ingest-opcua-data/ubuntu-virtual-machine.png" alt-text="Screenshot of the Azure portal showing Ubuntu virtual machine settings.":::
152
+
Use the [ARM Template to deploy IoT Edge enabled VM](https://github.com/Azure/iotedge-vm-deploy/tree/1.4) to deploy an Ubuntu virtual machine with IoT Edge. You can use the **Deploy to Azure** button to set the template options through the Azure portal. Fill in the values for the VM, keeping in mind these specifics:
153
+
* Remember the value you use for the **Dns Label Prefix**, as you'll use it to identify the device later.
154
+
* For **VM Size**, enter *Standard_B1ms*.
155
+
* For **Device Connection String**, enter the *primary connection string* you collected in the previous section while [setting up the IoT Edge device](#set-up-iot-edge-device).
159
156
160
-
> [!NOTE]
161
-
> If you choose to RDP into your Ubuntu VM, you can follow the instructions to [Install and configure xrdp to use Remote Desktop with Ubuntu](../virtual-machines/linux/use-remote-desktop.md).
157
+
When you're finished setting up the values, select **Review + create**. This will create the new VM, which you can find in the Azure portal under a resource name with the prefix *vm-* (the exact name is generated randomly).
162
158
163
-
#### Install IoT Edge container
159
+
Once the installation completes, connect to the new gateway VM.
164
160
165
-
Follow the instructions to [Install IoT Edge on Linux](../iot-edge/how-to-provision-single-device-linux-symmetric.md).
166
-
167
-
Once the installation completes, run the following command to verify the status of your installation:
161
+
Run the following command on the VM to verify the status of your IoT Edge installation:
168
162
169
163
```bash
170
-
admin@gateway:~$ sudo iotedge check
164
+
sudo iotedge check
171
165
```
172
166
173
167
This command will run several tests to make sure your installation is ready to go.
174
168
175
-
#### Install OPC Publisher module
176
-
177
-
Next, install the OPC Publisher module on your gateway device.
178
-
179
-
Start by getting the module from the [Azure Marketplace](https://azuremarketplace.microsoft.com/marketplace/apps/microsoft_iot.iotedge-opc-publisher).
169
+
> [!NOTE]
170
+
> You may see one error in the output related to IoT Edge Hub:
171
+
>
172
+
> **× production readiness: Edge Hub's storage directory is persisted on the host filesystem - Error**
173
+
>
174
+
> **Could not check current state of edgeHub container**
175
+
>
176
+
> This error is expected on a newly provisioned device because the IoT Edge Hub module isn't yet running. After the next step of installing the OPC Publisher module, this error will disappear.
180
177
181
-
:::image type="content" source="media/how-to-ingest-opcua-data/opc-publisher-1.png" alt-text="Screenshot of OPC publisher in Azure Marketplace.":::
178
+
#### Install OPC Publisher module
182
179
183
-
Then, follow the installation steps documented in the [OPC Publisher GitHub Repo](https://github.com/Azure/iot-edge-opc-publisher) to install the module on your Ubuntu VM.
180
+
Next, install the OPC Publisher module on your gateway device. You'll complete the first part of this section on your main working device (not the gateway device), and you'll provide information about the gateway device where the module should be installed.
184
181
185
-
In the step for [specifying container create options](https://github.com/Azure/iot-edge-opc-publisher#specifying-container-create-options-in-the-azure-portal), make sure to add the following json:
182
+
Follow the installation steps documented in the [OPC Publisher GitHub Repo](https://github.com/Azure/Industrial-IoT/blob/main/docs/modules/publisher.md) to install the module on your gateway device VM. Here are some things to keep in mind during this process:
183
+
* You'll be asked to connect to your IoT Hub and select the device where the module should be installed. You should see the **Dns label prefix** you created for the IoT Edge device earlier, and be able to select it as the gateway device.
184
+
* In the step for [specifying container create options](https://github.com/Azure/Industrial-IoT/blob/main/docs/modules/publisher.md#specifying-container-create-options-in-the-azure-portal), add the following json:
186
185
187
-
```JSON
188
-
{
189
-
"Hostname": "opcpublisher",
190
-
"Cmd": [
191
-
"--pf=/appdata/publishednodes.json",
192
-
"--aa"
193
-
],
194
-
"HostConfig": {
195
-
"Binds": [
196
-
"/iiotedge:/appdata"
197
-
]
186
+
```JSON
187
+
{
188
+
"Hostname": "opcpublisher",
189
+
"Cmd": [
190
+
"--pf=/appdata/publishednodes.json",
191
+
"--aa"
192
+
],
193
+
"HostConfig": {
194
+
"Binds": [
195
+
"/iiotedge:/appdata"
196
+
]
197
+
}
198
198
}
199
-
}
200
-
```
199
+
```
200
+
* On the **Routes** tab for the module creation, create a route with the value _FROM /* INTO $upstream_.
201
201
202
-
:::image type="content" source="media/how-to-ingest-opcua-data/opc-publisher-2.png" alt-text="Screenshot of OPC publisher container create options.":::
202
+
:::image type="content" source="media/how-to-ingest-opcua-data/set-route.png" alt-text="Screenshot of the Azure portal creating the route for the device module.":::
203
+
204
+
Follow the rest of the prompts to create the module.
203
205
204
206
>[!NOTE]
205
207
>The create options above should work in most cases without any changes, but if you're using your own gateway device that's different from the article guidance so far, you may need to adjust the settings to your situation.
206
208
207
-
Follow the rest of the prompts to create the module.
208
-
209
209
After about 15 seconds, you can run the `iotedge list` command on your gateway device, which lists all the modules running on your IoT Edge device. You should see the OPCPublisher module up and running.
210
210
211
211
:::image type="content" source="media/how-to-ingest-opcua-data/iotedge-list.png" alt-text="Screenshot of IoT Edge list results.":::
212
212
213
-
Finally, go to the `/iiotedge` directory and create a *publishednodes.json* file. The IDs in the file need to match the `NodeId` values that you [gathered earlier from the OPC Server](#install-opc-ua-simulation-software). Your file should look like something like this:
213
+
Finally, go to the `/iiotedge` directory on your gateway device, and create a *publishednodes.json* file. Use the following example file body to create your own similar file. Update the `EndpointUrl` value to match the connection address with the public IP value that you created while [installing the OPC UA simulation software](#install-opc-ua-simulation-software). Then, update the IDs in the file as needed to match the `NodeId` values that you [gathered earlier from the OPC Server](#install-opc-ua-simulation-software).
214
214
215
215
```JSON
216
216
[
@@ -243,7 +243,7 @@ Finally, go to the `/iiotedge` directory and create a *publishednodes.json* file
243
243
244
244
Save your changes to the *publishednodes.json* file.
245
245
246
-
Then, run the following command:
246
+
Then, run the following command on the gateway device:
247
247
248
248
```bash
249
249
sudo iotedge logs OPCPublisher -f
@@ -255,7 +255,7 @@ The command will result in the output of the OPC Publisher logs. If everything i
255
255
256
256
Data should now be flowing from an OPC UA Server into your IoT Hub.
257
257
258
-
To monitor the messages flowing into Azure IoT hub, you can use the following command:
258
+
To monitor the messages flowing into Azure IoT hub, you can run the following command for the Azure CLI on your main development machine:
259
259
260
260
```azurecli-interactive
261
261
az iot hub monitor-events -n <iot-hub-instance> -t 0
0 commit comments