Skip to content

Commit 260c7c6

Browse files
Merge pull request #213648 from baanders/10-4-opc
ADT: Update OPC UA article
2 parents d3f1809 + c377064 commit 260c7c6

File tree

4 files changed

+49
-49
lines changed

4 files changed

+49
-49
lines changed

articles/digital-twins/how-to-ingest-opcua-data.md

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
title: Ingest OPC UA data with Azure Digital Twins
44
titleSuffix: Azure Digital Twins
55
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
99
ms.topic: how-to
1010
ms.service: digital-twins
1111
# 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
7474

7575
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:
7676
* **Availability options**: No infrastructure redundancy required
77-
* **Image**: Windows 10 Pro, Version 2004 - Gen2
77+
* **Image**: Windows 10 Pro, Version 21H2 - Gen2
7878
* **Size**: Standard_B1s - 1 vcpu, 1 GiB memory
7979

8080
:::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
122122

123123
In this section, you'll set up an IoT Hub instance and an IoT Edge device.
124124

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).
126126

127127
:::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.":::
128128

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**.
130130

131131
:::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.":::
132132

133133
Follow the prompts to create a new device.
134134

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.
136136

137137
:::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.":::
138138

@@ -147,70 +147,70 @@ In this section, you set up IoT Edge and IoT Hub in preparation to create a gate
147147

148148
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.
149149

150-
#### Create Ubuntu Server virtual machine
150+
#### Create Ubuntu VM with IoT Edge
151151

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).
159156

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).
162158

163-
#### Install IoT Edge container
159+
Once the installation completes, connect to the new gateway VM.
164160

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:
168162

169163
```bash
170-
admin@gateway:~$ sudo iotedge check
164+
sudo iotedge check
171165
```
172166

173167
This command will run several tests to make sure your installation is ready to go.
174168

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.
180177
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
182179

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.
184181

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:
186185

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+
}
198198
}
199-
}
200-
```
199+
```
200+
* On the **Routes** tab for the module creation, create a route with the value _FROM /* INTO $upstream_.
201201

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.
203205

204206
>[!NOTE]
205207
>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.
206208

207-
Follow the rest of the prompts to create the module.
208-
209209
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.
210210

211211
:::image type="content" source="media/how-to-ingest-opcua-data/iotedge-list.png" alt-text="Screenshot of IoT Edge list results.":::
212212

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).
214214

215215
```JSON
216216
[
@@ -243,7 +243,7 @@ Finally, go to the `/iiotedge` directory and create a *publishednodes.json* file
243243

244244
Save your changes to the *publishednodes.json* file.
245245

246-
Then, run the following command:
246+
Then, run the following command on the gateway device:
247247

248248
```bash
249249
sudo iotedge logs OPCPublisher -f
@@ -255,7 +255,7 @@ The command will result in the output of the OPC Publisher logs. If everything i
255255

256256
Data should now be flowing from an OPC UA Server into your IoT Hub.
257257

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:
259259

260260
```azurecli-interactive
261261
az iot hub monitor-events -n <iot-hub-instance> -t 0
Binary file not shown.
Binary file not shown.
79.3 KB
Loading

0 commit comments

Comments
 (0)