Storing OPC UA Information Models in Azure Data Explorer
Published Jan 12 2024 01:31 AM 2,517 Views
Microsoft

Most Azure users deploy Azure Data Explorer (ADX) for storing and analyzing OPC UA PubSub telemetry data sent from industrial sites via a cloud broker. For the last several years, customers have also added OPC UA PubSub metadata to ADX as documented here (https://www.linkedin.com/pulse/using-azure-data-explorer-opc-ua-erich-barnstedt).

However, many customers are unaware that they can store entire OPC UA Information Models in ADX, imported from the UA Cloud Library (https://uacloudlibrary.opcfoundation.org).

 

This has several advantages:

  1. OPC UA PubSub metadata only describes the semantics of the associated OPC UA PubSub telemetry data, but not the entire OPC UA Information Model where the data originally came from. However, customers want to have all semantic information in one location, ideally in the cloud for global access.
  1. OPC UA PubSub metadata only includes a subset of the rich OPC UA semantics. For example, OPC UA complex type definitions or references to other data within the Information Model are not included but needed for deeper analysis of the telemetry data.
  1. Customers want to be able to see what other telemetry data is available from their sites for potential publishing to the cloud and need the entire OPC UA Information Model to make a selection.

 

To get started with importing OPC UA Information Models into ADX, you first need an instance of ADX in your Azure subscription as well as a login to the UA Cloud Library, hosted by the OPC Foundation. You can get registered for accessing the UA Cloud Library for free from here: https://uacloudlibrary.opcfoundation.org/Identity/Account/Register

 

Once you have registered, you can browse the OPC UA Information Models you are interested in via the built-in browser accessible from here: https://uacloudlibrary.opcfoundation.org/Explorer

 

To get the unique ID of the OPC UA Information Models you are interested in, you can simply execute the “namespaces” REST API from here: https://uacloudlibrary.opcfoundation.org/infomodel/namespaces. For example, the “Robotics” Information Model has the unique ID 4172981173.

 

Configure an Azure Data Explorer callout policy for the UA Cloud Library by running the following query on your ADX cluster (make sure you are an ADX cluster administrator, configurable under Permissions in the ADX tab in the Azure Portal):

.alter cluster policy callout @'[{"CalloutType": "webapi","CalloutUriRegex": "uacloudlibrary.opcfoundation.org","CanCall": true}]'
 
Then, simply run the following Azure Data Explorer query from the Azure Portal:

Then, from the Azure Portal UI of your ADX instance, simply run the following query to import the OPC UA Information Model into ADX:

let uri='https://uacloudlibrary.opcfoundation.org/infomodel/download/<insert information model identifier from cloud library here>';
let headers=dynamic({'accept':'text/plain'});
let options=dynamic({'Authorization':'Basic <insert your cloud library credentials hash here>'});
evaluate http_request(uri, headers, options)
| project title = tostring(ResponseBody.['title']), contributor = tostring(ResponseBody.contributor.name), nodeset = parse_xml(tostring(ResponseBody.nodeset.nodesetXml))
| mv-expand UAVariable=nodeset.UANodeSet.UAVariable
| project-away nodeset
| extend NodeId = UAVariable.['@NodeId'], DisplayName = tostring(UAVariable.DisplayName.['#text']), BrowseName = tostring(UAVariable.['@BrowseName']), DataType = tostring(UAVariable.['@DataType'])
| project-away UAVariable
| take 10000

You need to provide two things in the query above:

  1. The Information Model’s unique ID from the UA Cloud Library and enter it into the <insert information model identifier from cloud library here> field of the ADX query.
  1. Your UA Cloud Library credentials (generated during registration) basic authorization header hash and insert it into the <insert your cloud library credentials hash here> field of the ADX query. Use tools like https://www.debugbear.com/basic-auth-header-generator to generate this.

 

And voila! You have just imported an entire OPC UA Information Model into a temporary table in Azure Data Explorer which you can then use in your queries!

Co-Authors
Version history
Last update:
‎Jan 12 2024 01:31 AM
Updated by: