Edit

Share via


Configure the connector for OPC UA

OPC UA servers are software applications that communicate with assets. OPC UA servers expose OPC UA tags that represent tags. OPC UA tags provide real-time or historical data about the status, performance, quality, or condition of assets.

An asset in Azure IoT Operations is a logical entity that you create to represent a physical asset or device. An Azure IoT Operations asset can have custom properties, data points, streams, and events that describe its behavior and characteristics. An asset is associated with one or more devices. Azure IoT Operations stores asset definitions in the Azure Device Registry.

A device in Azure IoT Operations is a logical entity that defines the connections to physical assets or devices. Without a device, data can't flow from a physical device or asset to the MQTT broker. When you configure a device and asset, a connection is established to the physical asset or device and data point values, events, and streams arrive in Azure IoT Operations instance. A device has one or more inbound endpoints. Azure IoT Operations stores device definitions in the Azure Device Registry.

This article describes how to use the operations experience web UI and the Azure CLI to:

  • Define the devices that connect OPC UA servers to your Azure IoT Operations instance.
  • Add assets, and define their tags and events to enable data flow from OPC UA servers to the MQTT broker.

These assets, tags, and events map inbound data from OPC UA servers to friendly names that you can use in the MQTT broker and data flows.

Prerequisites

To configure devices and assets, you need a running preview instance of Azure IoT Operations.

To sign in to the operations experience web UI, you need a Microsoft Entra ID account with at least contributor permissions for the resource group that contains your Kubernetes - Azure Arc instance. You can't sign in with a Microsoft account (MSA). To create a suitable Microsoft Entra ID account in your Azure tenant:

  1. Sign in to the Azure portal with the same tenant and user name that you used to deploy Azure IoT Operations.
  2. In the Azure portal, go to the Microsoft Entra ID section, select Users > +New user > Create new user. Create a new user and make a note of the password, you need it to sign in later.
  3. In the Azure portal, go to the resource group that contains your Kubernetes - Azure Arc instance. On the Access control (IAM) page, select +Add > Add role assignment.
  4. On the Add role assignment page, select Privileged administrator roles. Then select Contributor and then select Next.
  5. On the Members page, add your new user to the role.
  6. Select Review and assign to complete setting up the new user.

You can now use the new user account to sign in to the operations experience web UI.

Your IT administrator must have configured the OPC UA connector template for your Azure IoT Operations instance in the Azure portal.

An OPC UA server that you can reach from your Azure IoT Operations cluster. If you don't have an OPC UA server, use the built-in OPC PLC simulator that comes with Azure IoT Operations.

Create a device

An Azure IoT Operations deployment can include an optional built-in OPC PLC simulator. To create a device that uses the built-in OPC PLC simulator:

  1. Select devices and then Create device:

    Screenshot that shows the devices page in the operations experience.

    Tip

    You can use the filter box to search for devices.

  2. On the Basics page, enter a device name and select New on the Microsoft.OpcUa tile to add an endpoint for the device:

    Screenshot that shows how to create a device in the operations experience.

  3. Enter your endpoint information. For example, to use the OPC PLC simulator, enter the following values:

    Field Value
    Name opc-ua-connector-0
    Connector for OPC UA URL opc.tcp://opcplc-000000:50000
    User authentication Anonymous
  4. Select Next and on the Additional Info page, enter any custom properties for the device.

  5. Select Next to review your device details. Then select Create.

This configuration deploys a new device resource called opc-ua-connector to the cluster with an inbound endpoint called opc-ua-connector-0.

When the OPC PLC simulator is running, data flows from the simulator, to the connector for OPC UA, and then to the MQTT broker.

Configure a device to use a username and password

The previous example uses the Anonymous authentication mode. This mode doesn't require a username or password.

To use the UsernamePassword authentication mode, complete the following steps:

  1. Follow the steps in Configure OPC UA user authentication with username and password to add secrets for username and password in Azure Key Vault, and project them into Kubernetes cluster.
  2. In the operations experience, select Username password for the User authentication field to configure the device endpoint to use these secrets. Then enter the following values for the Username reference and Password reference fields:
Field Value
Username reference aio-opc-ua-broker-user-authentication/username
Password reference aio-opc-ua-broker-user-authentication/password

Add an asset, tags, and events

To add an asset in the operations experience:

  1. Select the Assets tab. Before you create any assets, you see the following screen:

    Screenshot that shows an empty Assets tab in the operations experience.

    Tip

    You can use the filter box to search for assets.

  2. Select Create namespace asset.

  3. On the asset details screen, enter the following asset information:

    • Inbound endpoint. Select your device inbound endpoint from the list.
    • Asset name
    • Description
  4. Configure the set of custom properties that you want to associate with the asset. You can accept the default list of properties or add your own. The following properties are available by default:

    • Manufacturer
    • Manufacturer URI
    • Model
    • Product code
    • Hardware version
    • Software version
    • Serial number
    • Documentation URI

    Screenshot that shows how to add asset details in the operations experience.

  5. Select Next to go to the Tags page.

Add individual tags to an asset

Now you can define the tags associated with the asset. To add OPC UA tags:

  1. Select Add tag.

  2. Enter your tag details:

    • Data source. This value is the node ID from the OPC UA server.
    • Tag name (Optional). This value is the friendly name that you want to use for the tag. If you don't specify a tag name, the node ID is used as the tag name.
    • Publishing interval (milliseconds). You can override the default value for this tag.
    • Sampling interval (milliseconds). You can override the default value for this tag.
    • Queue size. You can override the default value for this tag.
    • Key frame count. You can override the default value for this tag.

    Screenshot that shows adding tags in the operations experience.

    The following table shows some example tag values that you can use with the built-in OPC PLC simulator:

    Data source Tag name
    ns=3;s=FastUInt10 Temperature
    ns=3;s=FastUInt100 Humidity
  3. To configure default settings for messages from the asset, select Manage default settings. These settings apply to all the OPC UA tags that belong to the asset. You can override these settings for each tag that you add. Default settings include:

    • Sampling interval (milliseconds): The sampling interval indicates the fastest rate at which the OPC UA server should sample its underlying source for data changes.
    • Publishing interval (milliseconds): The rate at which OPC UA server should publish data.
    • Queue size: The depth of the queue to hold the sampling data before publishing it.
  4. To configure the MQTT topic to publish the tag data to, select Manage default dataset. Enter an MQTT topic name such as azure-iot-operations/data/thermostat, then select Update.

  5. On the Tags page, select Next to go to the Add events page.

Add individual events to an asset

Now you can define the events associated with the asset. To add OPC UA events:

  1. Select Add event.

  2. Enter your event details:

    • Event notifier. This value is the event notifier from the OPC UA server.
    • Event name (Optional). This value is the friendly name that you want to use for the event. If you don't specify an event name, the event notifier is used as the event name.
    • Publishing interval (milliseconds). You can override the default value for this tag.
    • Sampling interval (milliseconds). You can override the default value for this tag.
    • Queue size. You can override the default value for this tag.
    • Key frame count. You can override the default value for this tag.

    Screenshot that shows adding events in the operations experience.

  3. Select Manage default settings to configure default event settings for the asset. These settings apply to all the OPC UA events that belong to the asset. You can override these settings for each event that you add. Default event settings include:

    • Publishing interval (milliseconds): The rate at which OPC UA server should publish data.
    • Queue size: The depth of the queue to hold the sampling data before publishing it.

Review your changes

Review your asset and OPC UA tag and event details and make any adjustments you need:

A screenshot that shows how to review your asset, tags, and events in the operations experience.

Update an asset

Find and select the asset you created previously. Use the Asset details, Tags, and Events tabs to make any changes:

A screenshot that shows how to update an existing asset in the operations experience.

On the Tags tab, you can add tags, update existing tags, or remove tags.

To update a tag, select an existing tag and update the tag information. Then select Update:

A screenshot that shows how to update an existing tag in the operations experience.

To remove tags, select one or more tags and then select Remove tags:

A screenshot that shows how to delete a tag in the operations experience.

You can also add, update, and delete events and properties in the same way.

When you're finished making changes, select Save to save your changes.

Delete an asset

To delete an asset, select the asset you want to delete. On the Asset details page, select Delete. Confirm your changes to delete the asset:

A screenshot that shows how to delete an asset from the operations experience.