Skip to content

Commit 210b4e9

Browse files
authored
Merge pull request #309356 from dominicbetts/aio-bicep-updates
AIO: Add connector bicep examples
2 parents 6e0d3b2 + 349afa8 commit 210b4e9

8 files changed

Lines changed: 677 additions & 26 deletions

articles/iot-operations/discover-manage-assets/howto-configure-opc-ua.md

Lines changed: 226 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Use the operations experience web UI or the Azure CLI to configure
44
author: dominicbetts
55
ms.author: dobett
66
ms.topic: how-to
7-
ms.date: 10/28/2025
7+
ms.date: 12/09/2025
88

99

1010
#CustomerIntent: As an OT user, I want configure my Azure IoT Operations environment so that data can flow from my OPC UA servers through to the MQTT broker.
@@ -33,7 +33,7 @@ To configure devices and assets, you need an instance of Azure IoT Operations.
3333

3434
[!INCLUDE [iot-operations-entra-id-setup](../includes/iot-operations-entra-id-setup.md)]
3535

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

3838
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 OPC PLC simulator from the Azure IoT Operations samples repository.
3939

@@ -48,7 +48,7 @@ An Azure IoT Operations deployment can include a sample OPC PLC simulator. To cr
4848
:::image type="content" source="media/howto-configure-opc-ua/devices.png" alt-text="Screenshot that shows the devices page in the operations experience." lightbox="media/howto-configure-opc-ua/devices.png":::
4949

5050
> [!TIP]
51-
> You can use the filter box to search for devices.
51+
> Use the filter box to search for devices.
5252
5353
1. On the **Basics** page, enter a device name and select **New** on the **Microsoft.OpcUa** tile to add an endpoint for the device:
5454

@@ -78,6 +78,49 @@ az iot ops ns device endpoint inbound add opcua --device opc-ua-connector-cli -g
7878

7979
To learn more, see [az iot ops ns device](/cli/azure/iot/ops/ns/device).
8080

81+
# [Bicep](#tab/bicep)
82+
83+
Deploy the following Bicep template to create a device with an inbound endpoint for the OPC UA connector. Replace the placeholders `<AIO_NAMESPACE_NAME>` and `<CUSTOM_LOCATION_NAME>` with your Azure IoT Operations namespace name and custom location name respectively:
84+
85+
```bicep
86+
param aioNamespaceName string = '<AIO_NAMESPACE_NAME>'
87+
param customLocationName string = '<CUSTOM_LOCATION_NAME>'
88+
89+
resource namespace 'Microsoft.DeviceRegistry/namespaces@2025-10-01' existing = {
90+
name: aioNamespaceName
91+
}
92+
93+
resource customLocation 'Microsoft.ExtendedLocation/customLocations@2021-08-31-preview' existing = {
94+
name: customLocationName
95+
}
96+
97+
resource device 'Microsoft.DeviceRegistry/namespaces/devices@2025-10-01' = {
98+
name: 'opc-ua-connector'
99+
parent: namespace
100+
location: resourceGroup().location
101+
extendedLocation: {
102+
type: 'CustomLocation'
103+
name: customLocation.id
104+
}
105+
properties: {
106+
endpoints: {
107+
outbound: {
108+
assigned: {}
109+
}
110+
inbound: {
111+
'opc-ua-connector-0': {
112+
endpointType: 'Microsoft.OpcUa'
113+
address: 'opc.tcp://opcplc-000000:50000'
114+
authentication: {
115+
method: 'Anonymous'
116+
}
117+
}
118+
}
119+
}
120+
}
121+
}
122+
```
123+
81124
---
82125

83126
This configuration deploys a new `device` resource called `opc-ua-connector` to the cluster with an inbound endpoint called `opc-ua-connector-0`.
@@ -98,13 +141,17 @@ To use the `UsernamePassword` authentication mode, complete the following steps:
98141

99142
[!INCLUDE [connector-username-password-cli](../includes/connector-username-password-cli.md)]
100143

144+
# [Bicep](#tab/bicep)
145+
146+
[!INCLUDE [connector-username-password-bicep](../includes/connector-username-password-bicep.md)]
147+
101148
---
102149

103150
### Other security options
104151

105152
To manage the trusted certificates list for the connector for OPC UA, see [Manage certificates for external communications](../secure-iot-ops/howto-manage-certificates.md#manage-certificates-for-external-communications).
106153

107-
When you create the inbound endpoint you can also select:
154+
When you create the inbound endpoint, you can also select:
108155

109156
| Option | Type | Description |
110157
| ------ | ---- | ----------- |
@@ -116,14 +163,14 @@ When you create the inbound endpoint you can also select:
116163

117164
# [Operations experience](#tab/portal)
118165

119-
To add an asset in the operations experience:
166+
To add an asset in the operations experience, follow these steps:
120167

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

123170
:::image type="content" source="media/howto-configure-opc-ua/create-asset-empty.png" alt-text="Screenshot that shows an empty Assets tab in the operations experience." lightbox="media/howto-configure-opc-ua/create-asset-empty.png":::
124171

125172
> [!TIP]
126-
> You can use the filter box to search for assets.
173+
> Use the filter box to search for assets.
127174
128175
1. Select **Create asset**.
129176

@@ -168,7 +215,7 @@ A dataset defines where the connector sends the data it collects from a collecti
168215
### Add individual data points to a dataset
169216

170217
> [!IMPORTANT]
171-
> The data point name `_ErrorMessage` is reserved and should not be used.
218+
> The data point name `_ErrorMessage` is reserved and shouldn't be used.
172219
173220
Now you can define the data points associated with the dataset. To add OPC UA data points:
174221

@@ -232,6 +279,77 @@ When you create an asset by using the Azure CLI, you can define:
232279
- Event specific values for sampling publishing interval, and queue size.
233280
- The observability mode for each data point and event
234281

282+
# [Bicep](#tab/bicep)
283+
284+
Deploy the following Bicep template to create an asset that publishes messages from the device shown previously to an MQTT topic. Replace the placeholders `<AIO_NAMESPACE_NAME>` and `<CUSTOM_LOCATION_NAME>` with your Azure IoT Operations namespace name and custom location name respectively:
285+
286+
```bicep
287+
param aioNamespaceName string = '<AIO_NAMESPACE_NAME>'
288+
param customLocationName string = '<CUSTOM_LOCATION_NAME>'
289+
290+
resource namespace 'Microsoft.DeviceRegistry/namespaces@2025-10-01' existing = {
291+
name: aioNamespaceName
292+
}
293+
294+
resource customLocation 'Microsoft.ExtendedLocation/customLocations@2021-08-31-preview' existing = {
295+
name: customLocationName
296+
}
297+
298+
resource asset 'Microsoft.DeviceRegistry/namespaces/assets@2025-10-01' = {
299+
name: 'thermostat'
300+
parent: namespace
301+
location: resourceGroup().location
302+
extendedLocation: {
303+
type: 'CustomLocation'
304+
name: customLocation.id
305+
}
306+
properties: {
307+
displayName: 'thermostat'
308+
description: 'A simulated thermostat asset'
309+
enabled: true
310+
311+
deviceRef: {
312+
deviceName: 'opc-ua-connector'
313+
endpointName: 'opc-ua-connector-0'
314+
}
315+
316+
defaultDatasetsConfiguration: '{}'
317+
defaultEventsConfiguration: '{}'
318+
319+
datasets: [
320+
{
321+
name: 'oven'
322+
dataSource: 'ns=3;s=FastUInt10'
323+
datasetConfiguration: '{}'
324+
dataPoints: [
325+
{
326+
name: 'temperature'
327+
dataSource: 'ns=3;s=FastUInt10'
328+
dataPointConfiguration: '{}'
329+
}
330+
{
331+
name: 'humidity'
332+
dataSource: 'ns=3;s=FastUInt100'
333+
dataPointConfiguration: '{}'
334+
}
335+
]
336+
destinations: [
337+
{
338+
target: 'Mqtt'
339+
configuration: {
340+
topic: 'azure-iot-operations/data/thermostat'
341+
qos: 'Qos1'
342+
retain: 'Keep'
343+
ttl: 3600
344+
}
345+
}
346+
]
347+
}
348+
]
349+
}
350+
}
351+
```
352+
235353
---
236354

237355
### Add individual events to an asset
@@ -263,7 +381,7 @@ Now you can define the events associated with the asset. To add OPC UA events in
263381

264382
### Event filters
265383

266-
Define event filters to customize the information that's included in event notifications from the server. By default, the server sends a selection of standard fields in event notifications. The exact selection is determined by the server for the event type. For example:
384+
Define event filters to customize the information that's included in event notifications from the server. By default, the server sends a selection of standard fields in event notifications. The server determines the exact selection for each event type. For example:
267385

268386
```json
269387
{
@@ -288,7 +406,7 @@ The following screenshot shows an example event filter:
288406

289407
:::image type="content" source="media/howto-configure-opc-ua/event-filter.png" alt-text="A screenshot that shows how to configure an event filter for an OPC UA asset." lightbox="media/howto-configure-opc-ua/event-filter.png":::
290408

291-
The complete event filter shown in the previous screenshot defines four output fields:
409+
The complete event filter shown in the preceding screenshot defines four output fields:
292410

293411
| Browse path | Type definition ID | Field ID |
294412
| --- | --- | --- |
@@ -299,7 +417,7 @@ The complete event filter shown in the previous screenshot defines four output f
299417

300418
The three properties for a filter row are:
301419

302-
- _Browse path_. Required value that identifies the source filed to include in the forwarded event notification.
420+
- _Browse path_. Required value that identifies the source field to include in the forwarded event notification.
303421
- _Type definition ID_. Optional value that specifies the OPC UA type definition of the source field.
304422
- _Field ID_. Optional value that specifies the name to use for the field in the forwarded event notification. If you don't specify a field ID, the original field name is used.
305423

@@ -316,7 +434,7 @@ The resulting message forwarded by the connector now looks like the following:
316434

317435
### Review your changes
318436

319-
Review your asset and OPC UA data point and event details and make any adjustments you need:
437+
Review your asset and OPC UA data point and event details. Make any adjustments you need:
320438

321439
:::image type="content" source="media/howto-configure-opc-ua/review-asset.png" alt-text="A screenshot that shows how to review your asset, data points, and events in the operations experience." lightbox="media/howto-configure-opc-ua/review-asset.png":::
322440

@@ -387,6 +505,99 @@ To delete a data point, use the `az iot ops ns asset opcua dataset point remove`
387505

388506
You can manage an asset's events by using the `az iot ops ns asset opcua event` commands.
389507

508+
# [Bicep](#tab/bicep)
509+
510+
To retrieve an asset by using Bicep, use a template like the following example:
511+
512+
```bicep
513+
param aioNamespaceName string = '<AIO_NAMESPACE_NAME>'
514+
515+
resource namespace 'Microsoft.DeviceRegistry/namespaces@2025-10-01' existing = {
516+
name: aioNamespaceName
517+
}
518+
519+
resource asset 'Microsoft.DeviceRegistry/namespaces/assets@2025-10-01' existing = {
520+
name: 'thermostat'
521+
parent: aioNamespaceName
522+
}
523+
524+
output asset object = asset
525+
```
526+
527+
To update an existing asset, for example to modify the description and add a data point, use a template like the following:
528+
529+
```bicep
530+
param aioNamespaceName string = '<AIO_NAMESPACE_NAME>'
531+
param customLocationName string = '<CUSTOM_LOCATION_NAME>'
532+
533+
resource namespace 'Microsoft.DeviceRegistry/namespaces@2025-10-01' existing = {
534+
name: aioNamespaceName
535+
}
536+
537+
resource customLocation 'Microsoft.ExtendedLocation/customLocations@2021-08-31-preview' existing = {
538+
name: customLocationName
539+
}
540+
541+
resource asset 'Microsoft.DeviceRegistry/namespaces/assets@2025-10-01' = {
542+
name: 'thermostat'
543+
parent: namespace
544+
location: resourceGroup().location
545+
extendedLocation: {
546+
type: 'CustomLocation'
547+
name: customLocation.id
548+
}
549+
properties: {
550+
displayName: 'thermostat'
551+
description: 'Updated thermostat asset with voltage data point'
552+
enabled: true
553+
554+
deviceRef: {
555+
deviceName: 'opc-ua-connector'
556+
endpointName: 'opc-ua-connector-0'
557+
}
558+
559+
defaultDatasetsConfiguration: '{}'
560+
defaultEventsConfiguration: '{}'
561+
562+
datasets: [
563+
{
564+
name: 'oven'
565+
dataSource: 'ns=3;s=FastUInt10'
566+
datasetConfiguration: '{}'
567+
dataPoints: [
568+
{
569+
name: 'temperature'
570+
dataSource: 'ns=3;s=FastUInt10'
571+
dataPointConfiguration: '{}'
572+
}
573+
{
574+
name: 'humidity'
575+
dataSource: 'ns=3;s=FastUInt100'
576+
dataPointConfiguration: '{}'
577+
}
578+
{
579+
name: 'voltage'
580+
dataSource: 'ns=3;s=FastUInt101'
581+
dataPointConfiguration: '{}'
582+
}
583+
]
584+
destinations: [
585+
{
586+
target: 'Mqtt'
587+
configuration: {
588+
topic: 'azure-iot-operations/data/thermostat'
589+
qos: 'Qos1'
590+
retain: 'Keep'
591+
ttl: 3600
592+
}
593+
}
594+
]
595+
}
596+
]
597+
}
598+
}
599+
```
600+
390601
---
391602

392603
## Delete an asset
@@ -405,6 +616,10 @@ To delete an asset, use a command that looks like the following example:
405616
az iot ops ns asset delete --name thermostat -g {your resource group name} --instance {your instance name}
406617
```
407618

619+
# [Bicep](#tab/bicep)
620+
621+
To delete individual resources by using Bicep, see [Deployment stacks](/azure/azure-resource-manager/bicep/quickstart-create-deployment-stacks).
622+
408623
---
409624

410625
## Related content

0 commit comments

Comments
 (0)