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
title: Discover OPC UA data sources using Azure IoT Akri
3
-
description: How to discover OPC UA data sources by using Azure IoT Akri
3
+
description: How to discover and configure OPC UA data sources at the edge automatically by using Azure IoT Akri
4
4
author: dominicbetts
5
5
ms.author: dobett
6
6
ms.subservice: akri
7
7
ms.topic: how-to
8
-
ms.date: 11/14/2023
8
+
ms.date: 05/15/2024
9
9
10
-
# CustomerIntent: As an industrial edge IT or operations user, I want to discover and create OPC UA data sources in my
11
-
# industrial edge environment so that I can reduce manual configuration overhead.
10
+
# CustomerIntent: As an industrial edge IT or operations user, I want to discover and create OPC UA data sources in my industrial edge environment so that I can reduce manual configuration overhead.
12
11
---
13
12
14
13
# Discover OPC UA data sources using Azure IoT Akri Preview
In this article, you learn how to discover OPC UA data sources. After you deploy Azure IoT Operations, you configure Azure IoT Akri Preview to discover OPC UA data sources at the edge. Azure IoT Akri creates custom resources into the Azure IoT Operations namespace on your cluster to represent the discovered devices. The capability to discover OPC UA data sources simplifies the process of manually configuring them from the cloud and onboarding them to your cluster. Currently, Azure IoT Akri can't detect and create assets that can be ingested into the Azure Device Registry Preview. For more information on supported features, see [Azure IoT Akri overview](overview-akri.md#features).
17
+
In this article, you learn how to discover OPC UA data sources automatically. After you deploy Azure IoT Operations, you configure Azure IoT Akri Preview to discover OPC UA data sources at the edge. Azure IoT Akri creates custom resources in your Kubernetes cluster that represent the data sources it discovers. The ability to discover OPC UA data sources removes the need to [manually configure them by using the Azure IoT Operations (preview) portal](howto-manage-assets-remotely.md).
19
18
20
-
Azure IoT Akri enables you to detect and create `Assets` in the address space of an OPC UA server. The OPC UA asset detection generates `AssetType` and `Asset` Kubernetes custom resources (CRs) for [OPC UA Device Integration (DI) specification](https://reference.opcfoundation.org/DI/v104/docs/) compliant `Assets`.
19
+
> [!IMPORTANT]
20
+
> Currently, you can't use Azure Device Registry to manage the assets that Azure IoT Akri discovers and creates.
21
+
22
+
Azure IoT Akri enables you to detect and create assets in the address space of an OPC UA server. The OPC UA asset detection generates `AssetType` and `Asset` custom resources for [OPC UA Device Integration (DI) specification](https://reference.opcfoundation.org/DI/v104/docs/) compliant assets.
21
23
22
24
## Prerequisites
23
25
24
-
- Azure IoT Operations Preview installed. The installation includes Azure IoT Akri. For more information, see [Quickstart: Deploy Azure IoT Operations Preview to an Arc-enabled Kubernetes cluster](../get-started/quickstart-deploy.md).
25
-
-Ensure that Azure IoT Akri agent pod is properly configured by running the following code:
26
+
-Install Azure IoT Operations Preview. To install Azure IoT Operations Preview for testing and exploration, see [Quickstart: Deploy Azure IoT Operations Preview to an Arc-enabled Kubernetes cluster](../get-started/quickstart-deploy.md).
27
+
-Verify that the Azure IoT Akri pods are properly configured by running the following command:
26
28
27
29
```bash
28
30
kubectl get pods -n azure-iot-operations
29
31
```
30
32
31
-
You should see the agent and discovery handler pod running.
32
-
33
+
The output includes lines that show the Akri agent and discovery handler pods are running:
34
+
33
35
```output
34
36
NAME READY STATUS RESTARTS AGE
35
37
aio-akri-agent-daemonset-hwpc7 1/1 Running 0 17m
@@ -38,30 +40,24 @@ Azure IoT Akri enables you to detect and create `Assets` in the address space of
38
40
39
41
## Configure the OPC UA discovery handler
40
42
41
-
To configure the custom OPC UA discovery handler with asset detection, first you create a YAML configuration file using the values described in this section. Before you create the file, note the following configuration details:
43
+
To configure the OPC UA discovery handler forasset detection, create a YAML configuration file that contains the values describedin this section:
42
44
43
-
- The specified server contains a sample address model that uses the Robotics companion specification, which is based on the DI specification. A model that uses these specifications is required for asset detection. The Robot contains five assets with observable variables and a `DeviceHealth` node that is automatically detected for monitoring.
44
-
- You can specify other servers by providing the `endpointUrl` and ensuring that a security `None` profile is enabled.
45
-
- To enable Azure IoT Akri to discover the servers, confirm that you specified the correct discovery endpoint URL during installation.
46
-
- Discovery URLs appear as `opc.tcp://<FQDN>:50000/`. To find the FQDNs of your OPC PLC servers, navigate to your deployments in the Azure portal. For each server, copy and paste the **FQDN** value into your discovery URLs. The following example demonstrates discovery of two OPC PLC servers. You can add the asset parameters for each OPC PLC server. If you only have one OPC PLC server, delete one of the assets.
|`EndpointUrl`|true| String | null | The OPC UA endpoint URL to use for asset discovery |
48
+
|`AutoAcceptUntrustedCertificates`|true ¹ | Boolean |false| Should the client autoaccept untrusted certificates? A certificate can only be autoaccepted as trusted if no nonsuppressible errors occurred during chain validation. For example, a certificate with incomplete chain isn't accepted. |
49
+
| `UseSecurity` | true ¹ | Boolean | true | Should the client use a secure connection? |
50
+
| `UserName` | false | String | null | The username for user authentication. ² |
51
+
| `Password` | false | String | null | The password for user authentication. ² |
>|`EndpointUrl`|true| String | null | The OPC UA endpoint URL to use for asset discovery |
53
-
>|`AutoAcceptUntrustedCertificates`|true ¹ | Boolean |false| Whether the client auto accepts untrusted certificates. A certificate can only be auto-accepted as trusted if no non-suppressible errors occurred during chain validation. For example, a certificate with incomplete chain is not accepted. |
54
-
>|`UseSecurity`|true ¹ | Boolean |true| Whether the client should use a secure connection |
55
-
>|`UserName`|false| String | null | The username for user authentication. ² |
56
-
>|`Password`|false| String | null | The user password for user authentication. ² |
57
-
58
-
¹ The current version of the discovery handler only supports no security `UseSecurity=false` and requires `autoAcceptUntrustedCertificates=true`.
59
-
² Temporary implementation until Azure IoT Akri can pass K8S secrets.
53
+
¹ The current version of the discovery handler only supports `UseSecurity=false` and requires `autoAcceptUntrustedCertificates=true`.
54
+
² A temporary implementation until Azure IoT Akri can pass Kubernetes secrets.
60
55
56
+
The following example demonstrates discovery of an OPC PLC server. You can add the asset parameters for multiple OPC PLC servers.
61
57
62
58
1. To create the YAML configuration file, copy and paste the following content into a new file, and save it as `opcua-configuration.yaml`:
63
-
64
-
If you're using the simulated PLC server that was deployed with the Azure IoT Operations Quickstart, you don't need to change the `endpointUrl`. If you have your own OPC UA servers running or are using the simulated PLC servers deployed on Azure, add in your endpoint URL accordingly.
59
+
60
+
If you're using the simulated PLC server that was deployed with the Azure IoT Operations Quickstart, you don't need to change the `endpointUrl`. If you have your own OPC UA servers running or are using the simulated PLC servers deployed on Azure, add in your endpoint URL accordingly. Discovery endpoint URLs look like `opc.tcp://<FQDN>:50000/`. To find the FQDNs of your OPC PLC servers, navigate to your deployment in the Azure portal. For each server, copy and paste the **FQDN** value into your endpoint URLs.
65
61
66
62
```yaml
67
63
apiVersion: akri.sh/v0
@@ -76,22 +72,25 @@ To configure the custom OPC UA discovery handler with asset detection, first you
76
72
capacity: 1
77
73
```
78
74
79
-
80
-
1. Apply the YAML to configure Azure Iot Akri to discover the assets:
75
+
1. To apply the configuration, run the following command:
1. To confirm that the asset discovery container is configured and started, check the pod logs with the following command:
81
+
## Verfiy the configuration
82
+
83
+
To confirm that the asset discovery container is configured and running:
84
+
85
+
1. Use the following command to check the pod logs:
87
86
88
87
```bash
89
88
kubectl logs <insert aio-akri-opcua-asset-discovery pod name> -n azure-iot-operations
90
89
```
91
90
92
91
A log from the `aio-akri-opcua-asset-discovery` pod indicates after a few seconds that the discovery handler registered itself with Azure IoT Akri:
93
92
94
-
```console
93
+
```output
95
94
2023-06-07 10:45:27.395 +00:00 info: OpcUaAssetDetection.Akri.Program[0] Akri OPC UA Asset Detection (0.2.0-alpha.203+Branch.main.Sha.cd4045345ad0d148cca4098b68fc7da5b307ce13) is starting with the process id: 1
96
95
2023-06-07 10:45:27.695 +00:00 info: OpcUaAssetDetection.Akri.Program[0] Got IP address of the pod from POD_IP environment variable.
97
96
2023-06-07 10:45:28.695 +00:00 info: OpcUaAssetDetection.Akri.Program[0] Registered with Akri system with Name opcua-asset for http://10.1.0.92:80 with type: Network as shared: True
@@ -100,7 +99,7 @@ To configure the custom OPC UA discovery handler with asset detection, first you
100
99
101
100
After about a minute, Azure IoT Akri issues the first discovery request based on the configuration:
After the discovery is completed, the result is sent back to Azure IoT Akri to create an Akri instance custom resource with asset information and observable variables. The discovery handler repeats the discovery every 10 minutes to detect changes on the server.
142
+
After the discovery is complete, the discovery handler sends the result back to Azure IoT Akri to create an Akri instance custom resource with asset information and observable variables. The discovery handler repeats the discovery every 10 minutes to detect any changes on the server.
145
143
146
144
1. To view the discovered Azure IoT Akri instances, run the following command:
147
145
148
146
```bash
149
147
kubectl get akrii -n azure-iot-operations
150
148
```
151
149
152
-
It might take a few minutes for the instance to show up.
153
-
154
150
The output from the previous command looks like the following example. You might need to wait for a few seconds for the Akri instance to be created:
You can inspect the instance custom resource by using an editor such as OpenLens, under `CustomResources/akri.sh/Instance`.
157
+
The OPC UA Connector supervisor watches for new Azure IoT Akri instance custom resources of type `opc-ua-asset`, and generates the initial asset types and asset custom resources for them. You can modify asset custom resources by adding settings such as extended publishing for more data points, or OPC UA Broker observability settings.
162
158
163
-
You can also view the custom resource definition YAML of the instance that was created:
164
-
165
-
```bash
166
-
kubectl get akrii -n azure-iot-operations -o yaml
167
-
```
168
-
169
-
The OPC UA Connector supervisor watches for new Azure IoT Akri instance custom resources of type`opc-ua-asset`, and generates the initial asset types and asset custom resources for them. You can modify asset custom resources to add settings such as extending publishing for more data points, or to add OPC UA Broker observability settings.
170
-
171
-
1. To confirm that the Akri instance properly connected to the OPC UA Broker, copy and paste the name of the Akri instance that was the output of the previous step, into the following command:
159
+
1. To confirm that the Akri instance properly connected to the OPC UA Broker, run the following command. Replace the placeholder with the name of the Akri instance that was included in the output of the previous command:
172
160
173
161
```bash
174
162
kubectl get akrii <AKRI_INSTANCE_NAME> -n azure-iot-operations -o json
175
163
```
176
164
177
-
The command output looks like the following example. This example output shows the Akri instance `brokerProperties` values and confirms that the OPC UA Broker is connected.
165
+
The command output includes a section that looks like the following example. The snippet shows the Akri instance `brokerProperties` values and confirms that the OPC UA Broker is connected.
178
166
179
167
```json
180
168
"spec": {
@@ -183,7 +171,3 @@ To configure the custom OPC UA discovery handler with asset detection, first you
0 commit comments