|
| 1 | +--- |
| 2 | +title: Automatically discover OPC UA assets (preview) |
| 3 | +description: How to automatically discover and configure OPC UA assets at the edge |
| 4 | +author: dominicbetts |
| 5 | +ms.subservice: azure-akri |
| 6 | +ms.author: dobett |
| 7 | +ms.topic: how-to |
| 8 | +ms.date: 04/02/2025 |
| 9 | + |
| 10 | +# CustomerIntent: As an industrial edge IT or operations user, I want to discover and create OPC UA assets in my industrial edge environment so that I can reduce manual configuration overhead. |
| 11 | +--- |
| 12 | + |
| 13 | +# Automatically discover and configure OPC UA assets (preview) |
| 14 | + |
| 15 | +In this article, you learn how to automatically discover and configure OPC UA assets connected to your Azure IoT Operations deployment. The automatic discovery process starts when you add an asset endpoint with the **Enable discovery** option selected. |
| 16 | + |
| 17 | +## Prerequisites |
| 18 | + |
| 19 | +- **Enable resource sync rules.** A deployed instance of Azure IoT Operations with resource sync rules enabled. To learn more, see [Deploy Azure IoT Operations](../deploy-iot-ops/overview-deploy.md). |
| 20 | + |
| 21 | + > [!IMPORTANT] |
| 22 | + > By default, the [deployment quickstart](../get-started-end-to-end-sample/quickstart-deploy.md) instructions do not enable resource sync rules. If resource sync rules aren't enabled on your instance, see [Enable resource sync rules on an existing instance](../troubleshoot/troubleshoot.md#you-want-to-enable-resource-sync-rules-on-an-existing-instance). |
| 23 | +
|
| 24 | +- **Set permissions on your custom location.** The custom location in the resource group where you deployed Azure IoT Operations must have the **Azure Kubernetes Service Arc Contributor Role** role enabled with **K8 Bridge** as a member: For example: |
| 25 | + |
| 26 | + # [Azure portal](#tab/portal) |
| 27 | + |
| 28 | + 1. Go to the custom location for your Azure IoT Operations instance in the Azure portal. |
| 29 | + |
| 30 | + 1. Select **Access control (IAM)**. |
| 31 | + |
| 32 | + 1. Select **Add > Add role assignment**. |
| 33 | + |
| 34 | + 1. Search for and select the **Azure Kubernetes Service Arc Contributor Role** role. Then click **Next**. |
| 35 | + |
| 36 | + 1. Select **Select members**. Search for and select **K8 Bridge**. Then click **Review + Assign**. |
| 37 | + |
| 38 | + 1. To finish adding the role assignment, select **Review + assign** again. |
| 39 | + |
| 40 | + # [Azure CLI](#tab/cli) |
| 41 | + |
| 42 | + ```bash |
| 43 | + CUSTOM_LOCATION_NAME=$(az iot ops list -g <YOUR RESOURCE GROUP> --query "[0].extendedLocation.name" -o tsv) |
| 44 | + |
| 45 | + ASSIGNEE=$(az ad sp list --display-name "K8 Bridge" --query "[0].appId" -o tsv) |
| 46 | + |
| 47 | + az role assignment create --role "Azure Kubernetes Service Arc Contributor Role" --assignee $ASSIGNEE --scope $CUSTOM_LOCATION_NAME |
| 48 | + ``` |
| 49 | + |
| 50 | + --- |
| 51 | + |
| 52 | +## Deploy the preview connectors |
| 53 | + |
| 54 | +Currently, discovery is only enabled in the preview version of the connector for OPC UA. |
| 55 | + |
| 56 | +[!INCLUDE [deploy-preview-media-connectors](../includes/deploy-preview-media-connectors.md)] |
| 57 | + |
| 58 | +## Create an asset endpoint |
| 59 | + |
| 60 | +To create an asset endpoint with discovery enabled: |
| 61 | + |
| 62 | +1. Go to your Azure IoT Operations instance in the operations experience web UI. |
| 63 | + |
| 64 | +1. Add a new asset endpoint and select the **Enable discovery** option: |
| 65 | + |
| 66 | + :::image type="content" source="media/howto-autodetect-opc-ua-assets-use-akri/enable-auto-discover.png" alt-text="Screenshot that shows how to create an asset endpoint with discovery enabled."::: |
| 67 | + |
| 68 | +1. Select **Create** to create the asset endpoint. |
| 69 | + |
| 70 | +## Review the discovered assets |
| 71 | + |
| 72 | +Azure IoT Operations uses the asset endpoint to connect to the OPC UA server and scan for assets. To view the discovered assets: |
| 73 | + |
| 74 | +1. Go to the **Discovery** page for your instance in the operations experience: |
| 75 | + |
| 76 | + :::image type="content" source="media/howto-autodetect-opc-ua-assets-use-akri/discovered-assets-list.png" alt-text="Screenshot that shows how to view discovered assets."::: |
| 77 | + |
| 78 | +1. You can filter the list by the asset endpoint name, or by keyword. The list shows the discovered assets and their status. |
| 79 | + |
| 80 | +## Import an asset from a discovered asset |
| 81 | + |
| 82 | +From the list of discovered assets, you can import an asset into your Azure IoT Operations instance. To import an asset: |
| 83 | + |
| 84 | +1. Select the asset you want to import from the list of discovered assets. Then select **+ Import and create asset**. |
| 85 | + |
| 86 | +1. The site takes you to the **Add asset details** page, where you can review the asset details and make any changes. The asset name is automatically populated with the name of the discovered asset, but you can override the name on this page: |
| 87 | + |
| 88 | + :::image type="content" source="media/howto-autodetect-opc-ua-assets-use-akri/add-asset-details.png" alt-text="Screenshot that shows an asset created from a discovered asset."::: |
| 89 | + |
| 90 | +1. Step through the rest of the **Create asset** pages and select the imported tags and events that you want to use: |
| 91 | + |
| 92 | + :::image type="content" source="media/howto-autodetect-opc-ua-assets-use-akri/add-imported-tags.png" alt-text="Screenshot that shows how to modify the tags of an imported asset."::: |
| 93 | + |
| 94 | +1. The imported asset is created in your Azure IoT Operations instance. You can view the asset in the **Assets** page of the operations experience: |
| 95 | + |
| 96 | + :::image type="content" source="media/howto-autodetect-opc-ua-assets-use-akri/provisioned-asset.png" alt-text="Screenshot that shows how to view the imported asset."::: |
| 97 | + |
| 98 | +To learn more about managing asset configurations, see [Manage asset configurations remotely](howto-manage-assets-remotely.md). |
| 99 | + |
| 100 | +## Review the asset definitions in the Azure portal (optional) |
| 101 | + |
| 102 | +Both the discovered asset and the imported asset are visible in your resource group in the Azure portal: |
| 103 | + |
| 104 | +:::image type="content" source="media/howto-autodetect-opc-ua-assets-use-akri/portal-assets.png" alt-text="Screenshot that shows how to view the discovered and imported asset in the Azure portal."::: |
| 105 | + |
| 106 | +## Review the custom resource definitions in your cluster (optional) |
| 107 | + |
| 108 | +To review the discovered assets in your cluster, you can use the `kubectl` command line tool: |
| 109 | + |
| 110 | +```console |
| 111 | +kubectl get discoveredassets -n azure-iot-operations |
| 112 | +``` |
| 113 | + |
| 114 | +To view the details of a discovered asset, use the following command: |
| 115 | + |
| 116 | +```console |
| 117 | +kubectl describe discoveredasset <name> -n azure-iot-operations |
| 118 | +``` |
| 119 | + |
| 120 | +> [!TIP] |
| 121 | +> The previous commands assume that you installed your Azure IoT Operations instance in the default `azure-iot-operations` namespace. If you installed it in a different namespace, replace `azure-iot-operations` with the name of your namespace. |
| 122 | + |
| 123 | +## Use the imported asset in your data flows |
| 124 | + |
| 125 | +After you complete the import process for a discovered asset, you can use the imported asset in your data flows. Imported asset definitions behave in exactly the same way as manually entered asset definitions. To learn more, see [Create and manage data flows](../connect-to-cloud/howto-create-dataflow.md). |
0 commit comments