Skip to content

Commit 1f4bacb

Browse files
changed dataflow bicep file
1 parent 7d2d503 commit 1f4bacb

File tree

1 file changed

+61
-9
lines changed

1 file changed

+61
-9
lines changed

articles/iot-operations/connect-to-cloud/howto-create-dataflow.md

Lines changed: 61 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,65 @@ To create a dataflow in [operations experience](https://iotoperations.azure.com/
6060

6161
# [Bicep](#tab/bicep)
6262

63-
The [Bicep File to create Dataflow](https://github.com/Azure-Samples/explore-iot-operations/blob/main/samples/quickstarts/dataflow.bicep) deploys the necessary resources for dataflows.
63+
1. Create a dataflow bicep file `dataflow.bicep`. Replace the placeholder values like `<SCHEMA_REGISTRY_NAME>` with your own.
6464

65-
1. Download the template file and replace the values for `customLocationName`, `aioInstanceName`, `schemaRegistryName`, `opcuaSchemaName`, and `persistentVCName`.
66-
67-
1. Deploy the resources using the [az stack group](/azure/azure-resource-manager/bicep/deployment-stacks?tabs=azure-powershell) command in your terminal:
65+
```bicep
66+
var opcuaSchemaContent = '''
67+
{
68+
"$schema": "Delta/1.0",
69+
"type": "object",
70+
"properties": {
71+
"type": "struct",
72+
"fields": [
73+
{ "name": "AssetId", "type": "string", "nullable": true, "metadata": {} },
74+
{ "name": "Temperature", "type": "double", "nullable": true, "metadata": {} },
75+
{ "name": "Timestamp", "type": "string", "nullable": true, "metadata": {} }
76+
]
77+
}
78+
}
79+
'''
6880
69-
```azurecli
70-
az stack group create --name MyDeploymentStack --resource-group $RESOURCE_GROUP --template-file /workspaces/explore-iot-operations/<filename>.bicep --action-on-unmanage 'deleteResources' --deny-settings-mode 'none' --yes
71-
```
81+
param defaultDataflowEndpointName string = 'default'
82+
param defaultDataflowProfileName string = 'default'
83+
param schemaRegistryName string = '<SCHEMA_REGISTRY_NAME>'
7284
73-
The overall structure of a dataflow configuration for Bicep is as follows:
85+
param opcuaSchemaName string = 'opcua-output-delta'
86+
param opcuaSchemaVer string = '1'
87+
88+
resource defaultDataflowEndpoint 'Microsoft.IoTOperations/instances/dataflowEndpoints@2024-08-15-preview' existing = {
89+
parent: aioInstance
90+
name: defaultDataflowEndpointName
91+
}
92+
93+
resource defaultDataflowProfile 'Microsoft.IoTOperations/instances/dataflowProfiles@2024-08-15-preview' existing = {
94+
parent: aioInstance
95+
name: defaultDataflowProfileName
96+
}
97+
98+
resource schemaRegistry 'Microsoft.DeviceRegistry/schemaRegistries@2024-09-01-preview' existing = {
99+
name: schemaRegistryName
100+
}
101+
102+
resource opcSchema 'Microsoft.DeviceRegistry/schemaRegistries/schemas@2024-09-01-preview' = {
103+
parent: schemaRegistry
104+
name: opcuaSchemaName
105+
properties: {
106+
displayName: 'OPC UA Delta Schema'
107+
description: 'This is a OPC UA delta Schema'
108+
format: 'Delta/1.0'
109+
schemaType: 'MessageSchema'
110+
}
111+
}
112+
113+
resource opcuaSchemaInstance 'Microsoft.DeviceRegistry/schemaRegistries/schemas/schemaVersions@2024-09-01-preview' = {
114+
parent: opcSchema
115+
name: opcuaSchemaVer
116+
properties: {
117+
description: 'Schema version'
118+
schemaContent: opcuaSchemaContent
119+
}
120+
}
74121
75-
```bicep
76122
resource dataflow 'Microsoft.IoTOperations/instances/dataflowProfiles/dataflows@2024-08-15-preview' = {
77123
parent: defaultDataflowProfile
78124
name: 'my-dataflow'
@@ -106,6 +152,12 @@ resource dataflow 'Microsoft.IoTOperations/instances/dataflowProfiles/dataflows@
106152
}
107153
```
108154

155+
1. Deploy via Azure CLI
156+
157+
```azurecli
158+
az stack group create --name MyDeploymentStack --resource-group <RESOURCE_GROUP> --template-file dataflow.bicep
159+
```
160+
109161
# [Kubernetes](#tab/kubernetes)
110162

111163
The overall structure of a dataflow configuration is as follows:

0 commit comments

Comments
 (0)