Skip to content

Commit f674ad3

Browse files
committed
Update autodetect how-to
1 parent 5d19b04 commit f674ad3

File tree

1 file changed

+39
-55
lines changed

1 file changed

+39
-55
lines changed
Lines changed: 39 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,37 @@
11
---
22
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
44
author: dominicbetts
55
ms.author: dobett
66
ms.subservice: akri
77
ms.topic: how-to
8-
ms.date: 11/14/2023
8+
ms.date: 05/15/2024
99

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.
1211
---
1312

1413
# Discover OPC UA data sources using Azure IoT Akri Preview
1514

1615
[!INCLUDE [public-preview-note](../includes/public-preview-note.md)]
1716

18-
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).
1918

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

2224
## Prerequisites
2325

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

2729
```bash
2830
kubectl get pods -n azure-iot-operations
2931
```
3032

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+
3335
```output
3436
NAME READY STATUS RESTARTS AGE
3537
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
3840

3941
## Configure the OPC UA discovery handler
4042

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 for asset detection, create a YAML configuration file that contains the values described in this section:
4244

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.
47-
45+
| Name | Mandatory | Datatype | Default | Comment |
46+
| ---- | --------- | -------- | ------- | ------- |
47+
| `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. ² |
4852
49-
> [!div class="mx-tdBreakAll"]
50-
> | Name | Mandatory | Datatype | Default | Comment |
51-
> | --------------------------------- | ----------------- | -------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
52-
> | `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.
6055
56+
The following example demonstrates discovery of an OPC PLC server. You can add the asset parameters for multiple OPC PLC servers.
6157
6258
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.
6561
6662
```yaml
6763
apiVersion: akri.sh/v0
@@ -76,22 +72,25 @@ To configure the custom OPC UA discovery handler with asset detection, first you
7672
capacity: 1
7773
```
7874
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:
8176
8277
```bash
8378
kubectl apply -f opcua-configuration.yaml -n azure-iot-operations
8479
```
8580
86-
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:
8786
8887
```bash
8988
kubectl logs <insert aio-akri-opcua-asset-discovery pod name> -n azure-iot-operations
9089
```
9190
9291
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:
9392
94-
```console
93+
```output
9594
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
9695
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.
9796
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
10099
101100
After about a minute, Azure IoT Akri issues the first discovery request based on the configuration:
102101
103-
```console
102+
```output
104103
2023-06-07 12:49:17.344 +00:00 dbug: Grpc.AspNetCore.Server.ServerCallHandler[10]
105104
=> SpanId:603279c62c9ccbb0, TraceId:15ad328e1e803c55bc6731266aae8725, ParentId:0000000000000000 => ConnectionId:0HMR7AMCHHG2G => RequestPath:/v0.DiscoveryHandler/Discover RequestId:0HMR7AMCHHG2G:00000001
106105
Reading message.
@@ -138,43 +137,32 @@ To configure the custom OPC UA discovery handler with asset detection, first you
138137
2023-06-07 14:20:05.004 +00:00 info: OpcUa.AssetDiscovery.Akri.Services.DiscoveryHandlerService[0]
139138
=> SpanId:603279c62c9ccbb0, TraceId:15ad328e1e803c55bc6731266aae8725, ParentId:0000000000000000 => ConnectionId:0HMR7AMCHHG2G => RequestPath:/v0.DiscoveryHandler/Discover RequestId:0HMR7AMCHHG2G:00000001
140139
Sent successfully
141-
142140
```
143141
144-
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.
145143
146144
1. To view the discovered Azure IoT Akri instances, run the following command:
147145
148146
```bash
149147
kubectl get akrii -n azure-iot-operations
150148
```
151149
152-
It might take a few minutes for the instance to show up.
153-
154150
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:
155-
156-
```console
151+
152+
```output
157153
NAMESPACE NAME CONFIG SHARED NODES AGE
158154
azure-iot-operations akri-opcua-asset-dbdef0 akri-opcua-asset true ["my-aio-vm"] 35m
159155
```
160156
161-
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.
162158
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:
172160
173161
```bash
174162
kubectl get akrii <AKRI_INSTANCE_NAME> -n azure-iot-operations -o json
175163
```
176164
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.
178166
179167
```json
180168
"spec": {
@@ -183,7 +171,3 @@ To configure the custom OPC UA discovery handler with asset detection, first you
183171
"ApplicationUri": "Boiler #2",
184172
"AssetEndpointProfile": "{\"spec\":{\"uuid\":\"opc-ua-broker-opcplc-000000-azure-iot-operation\"……
185173
```
186-
187-
## Related content
188-
189-
- [Azure IoT Akri overview](overview-akri.md)

0 commit comments

Comments
 (0)