@@ -24,7 +24,9 @@ To learn more, see [OPC UA certificates infrastructure for the connector for OPC
24
24
25
25
## Prerequisites
26
26
27
- A deployed instance of Azure IoT Operations Preview. To deploy Azure IoT Operations for demonstration and exploration purposes, see [ Quickstart: Run Azure IoT Operations Preview in GitHub Codespaces with K3s] ( ../get-started-end-to-end-sample/quickstart-deploy.md ) .
27
+ - A deployed instance of Azure IoT Operations Preview. To deploy Azure IoT Operations for demonstration and exploration purposes, see [ Quickstart: Run Azure IoT Operations Preview in GitHub Codespaces with K3s] ( ../get-started-end-to-end-sample/quickstart-deploy.md ) .
28
+
29
+ - [ Enable secure settings in Azure IoT Operations Preview deployment] ( ../deploy-iot-ops/howto-enable-secure-settings.md )
28
30
29
31
## Configure a self-signed application instance certificate
30
32
@@ -43,44 +45,20 @@ To connect to an asset, first you need to establish the application authenticati
43
45
44
46
1 . Add the OPC UA server's application instance certificate to the trusted certificates list. This list is implemented as a Kubernetes native secret named * aio-opc-ua-broker-trust-list* that's created when you deploy Azure IoT Operations.
45
47
46
- # [ Bash] ( #tab/bash )
47
-
48
- For a DER encoded certificate in a file such as * ./my-server.der* , run the following command:
49
-
50
- ``` bash
51
- # Append my-server.der OPC UA server certificate to the trusted certificate list secret as a new entry
52
- data=$( kubectl create secret generic temp --from-file=my-server.der=./my-server.der --dry-run=client -o jsonpath=' {.data}' )
53
- kubectl patch secret aio-opc-ua-broker-trust-list -n azure-iot-operations -p " {\" data\" : $data }"
54
- ```
55
-
56
- For a PEM encoded certificate in a file such as * ./my-server.crt* , run the following command:
57
-
58
- ` ` ` bash
59
- # Append my-server.crt OPC UA server certificate to the trusted certificate list secret as a new entry
60
- data=$( kubectl create secret generic temp --from-file=my-server.crt=./my-server.crt --dry-run=client -o jsonpath=' {.data}' )
61
- kubectl patch secret aio-opc-ua-broker-trust-list -n azure-iot-operations -p " {\" data\" : $data }"
62
- ` ` `
63
-
64
- # [PowerShell](#tab/powershell)
65
-
66
48
For a DER encoded certificate in a file such as * ./my-server.der* , run the following command:
67
49
68
- ` ` ` powershell
50
+ ``` azurecli
69
51
# Append my-server.der OPC UA server certificate to the trusted certificate list secret as a new entry
70
- $data = kubectl create secret generic temp --from-file=my-server.der=./my-server.der --dry-run=client -o jsonpath=' {.data}'
71
- kubectl patch secret aio-opc-ua-broker-trust-list -n azure-iot-operations -p " {` " data` " : $data }"
52
+ az iot ops connector opcua trust add --instance $INSTANCE_NAME --resource-group $RESOURCE_GROUP --certificate-file "./my-server.der"
72
53
```
73
54
74
55
For a PEM encoded certificate in a file such as *./my-server.crt*, run the following command:
75
56
76
- ` ` ` powershell
57
+ ```azurecli
77
58
# Append my-server.crt OPC UA server certificate to the trusted certificate list secret as a new entry
78
- $data = kubectl create secret generic temp --from-file=my-server.crt=./my-server.crt --dry-run=client -o jsonpath=' {.data}'
79
- kubectl patch secret aio-opc-ua-broker-trust-list -n azure-iot-operations -p " {` " data` " : $data }"
59
+ az iot ops connector opcua trust add --instance $INSTANCE_NAME --resource-group $RESOURCE_GROUP --certificate-file "./my-server.crt"
80
60
```
81
61
82
- ---
83
-
84
62
If your OPC UA server uses a certificate issued by a certificate authority (CA), you can trust the CA by adding its public key certificate to the connector for OPC UA trusted certificates list. The connector for OPC UA now automatically trusts all the servers that use a valid certificate issued by the CA. Therefore, you don't need to explicitly add the OPC UA server's certificate to the connector for OPC UA trusted certificates list.
85
63
86
64
To trust a CA, complete the following steps:
@@ -95,8 +73,7 @@ To trust a CA, complete the following steps:
95
73
96
74
```bash
97
75
# Append CA certificate to the trusted certificate list secret as a new entry
98
- data=$( kubectl create secret generic temp --from-file=my-server-ca.der=./my-server-ca.der --dry-run=client -o jsonpath=' {.data}' )
99
- kubectl patch secret aio-opc-ua-broker-trust-list -n azure-iot-operations -p " {` " data` " : $data }"
76
+ az iot ops connector opcua trust add --instance $INSTANCE_NAME --resource-group $RESOURCE_GROUP --certificate-file "./my-server-ca.der"
100
77
101
78
# Append the CRL to the trusted certificate list secret as a new entry
102
79
data=$(kubectl create secret generic temp --from-file= my-server-ca.crl=./ my-server-ca.crl --dry-run=client -o jsonpath='{.data}')
@@ -107,8 +84,7 @@ To trust a CA, complete the following steps:
107
84
108
85
```bash
109
86
# Append CA certificate to the trusted certificate list secret as a new entry
110
- data=$( kubectl create secret generic temp --from-file=my-server-ca.crt=./my-server-ca.crt --dry-run=client -o jsonpath=' {.data}' )
111
- kubectl patch secret aio-opc-ua-broker-trust-list -n azure-iot-operations -p " {` " data` " : $data }"
87
+ az iot ops connector opcua trust add --instance $INSTANCE_NAME --resource-group $RESOURCE_GROUP --certificate-file "./my-server-ca.crt"
112
88
113
89
# Append the CRL to the trusted certificates list secret as a new entry
114
90
data=$(kubectl create secret generic temp --from-file=my-server-ca.crl=./my-server-ca.crl --dry-run=client -o jsonpath='{.data}')
@@ -121,8 +97,7 @@ To trust a CA, complete the following steps:
121
97
122
98
```powershell
123
99
# Append CA certificate to the trusted certificate list secret as a new entry
124
- $data = kubectl create secret generic temp --from-file=my-server-ca.der=./my-server-ca.der --dry-run=client -o jsonpath=' {.data}'
125
- kubectl patch secret aio-opc-ua-broker-trust-list -n azure-iot-operations -p " {` " data` " : $data }"
100
+ az iot ops connector opcua trust add --instance $INSTANCE_NAME --resource-group $RESOURCE_GROUP --certificate-file "./my-server-ca.der"
126
101
127
102
# Append the CRL to the trusted certificate list secret as a new entry
128
103
$data = kubectl create secret generic temp --from-file=my-server-ca.crl=./my-server-ca.crl --dry-run=client -o jsonpath='{.data}'
@@ -133,8 +108,7 @@ To trust a CA, complete the following steps:
133
108
134
109
```powershell
135
110
# Append CA certificate to the trusted certificate list secret as a new entry
136
- $data = kubectl create secret generic temp --from-file=my-server-ca.crt=./my-server-ca.crt --dry-run=client -o jsonpath=' {.data}'
137
- kubectl patch secret aio-opc-ua-broker-trust-list -n azure-iot-operations -p " {` " data` " : $data }"
111
+ az iot ops connector opcua trust add --instance $INSTANCE_NAME --resource-group $RESOURCE_GROUP --certificate-file "./my-server-ca.crt"
138
112
139
113
# Append the CRL to the trusted certificate list secret as a new entry
140
114
$data = kubectl create secret generic temp --from-file=my-server-ca.crl=./my-server-ca.crl --dry-run=client -o jsonpath='{.data}'
@@ -153,60 +127,24 @@ If your OPC UA server uses a certificate issued by a CA, but you don't want to t
153
127
154
128
1. Save the CA certificate and the CRL in the `aio-opc-ua-broker-issuer-list` secret.
155
129
156
- # [Bash](#tab/bash)
157
-
158
- For a DER encoded certificate in a file such as *./my-server-ca.der*, run the following commands:
159
-
160
- ` ` ` bash
130
+ ```azurecli
161
131
# Append CA certificate to the issuer list secret as a new entry
162
- data=$( kubectl create secret generic temp --from-file=my-server-ca.der=./my-server-ca.der --dry-run=client -o jsonpath=' {.data}' )
163
- kubectl patch secret aio-opc-ua-broker-issuer-list -n azure-iot-operations -p " {` " data` " : $data }"
132
+ az iot ops connector opcua issuer add --instance $INSTANCE_NAME --resource-group $RESOURCE_GROUP --certificate-file "./my-server-ca.der"
164
133
165
134
# Append the CRL to the issuer list secret as a new entry
166
- data=$( kubectl create secret generic temp --from-file=my-server-ca.crl=./my-server-ca.crl --dry-run=client -o jsonpath=' {.data}' )
167
- kubectl patch secret aio-opc-ua-broker-issuer-list -n azure-iot-operations -p " {` " data` " : $data }"
135
+ az iot ops connector opcua issuer add --instance $INSTANCE_NAME --resource-group $RESOURCE_GROUP --certificate-file "./my-server-ca.crl"
168
136
```
169
137
170
138
For a PEM encoded certificate in a file such as *./my-server-ca.crt*, run the following commands:
171
139
172
- ` ` ` bash
173
- # Append CA certificate to the issuer list secret as a new entry
174
- data=$( kubectl create secret generic temp --from-file=my-server-ca.crt=./my-server-ca.crt --dry-run=client -o jsonpath=' {.data}' )
175
- kubectl patch secret aio-opc-ua-broker-issuer-list -n azure-iot-operations -p " {` " data` " : $data }"
176
-
177
- # Append the CRL to the issuer list secret as a new entry
178
- data=$( kubectl create secret generic temp --from-file=my-server-ca.crl=./my-server-ca.crl --dry-run=client -o jsonpath=' {.data}' )
179
- kubectl patch secret aio-opc-ua-broker-issuer-list -n azure-iot-operations -p " {` " data` " : $data }"
180
- ` ` `
181
-
182
- # [PowerShell](#tab/powershell)
183
-
184
- For a DER encoded certificate in a file such as *./my-server-ca.der*, run the following commands:
185
-
186
- ` ` ` powershell
140
+ ```azurecli
187
141
# Append CA certificate to the issuer list secret as a new entry
188
- $data = kubectl create secret generic temp --from-file=my-server-ca.der=./my-server-ca.der --dry-run=client -o jsonpath=' {.data}'
189
- kubectl patch secret aio-opc-ua-broker-issuer-list -n azure-iot-operations -p " {` " data` " : $data }"
142
+ az iot ops connector opcua issuer add --instance $INSTANCE_NAME --resource-group $RESOURCE_GROUP --certificate-file "./my-server-ca.crt"
190
143
191
144
# Append the CRL to the issuer list secret as a new entry
192
- $data = kubectl create secret generic temp --from-file=my-server-ca.crl=./my-server-ca.crl --dry-run=client -o jsonpath=' {.data}'
193
- kubectl patch secret aio-opc-ua-broker-issuer-list -n azure-iot-operations -p " {` " data` " : $data }"
145
+ az iot ops connector opcua issuer add --instance $INSTANCE_NAME --resource-group $RESOURCE_GROUP --certificate-file "./my-server-ca.crl"
194
146
```
195
147
196
- For a PEM encoded certificate in a file such as *./my-server-ca.crt*, run the following commands:
197
-
198
- ` ` ` powershell
199
- # Append CA certificate to the issuer list secret as a new entry
200
- $data = kubectl create secret generic temp --from-file=my-server-ca.crt=./my-server-ca.crt --dry-run=client -o jsonpath=' {.data}'
201
- kubectl patch secret aio-opc-ua-broker-issuer-list -n azure-iot-operations -p " {` " data` " : $data }"
202
-
203
- # Append the CRL to the issuer list secret as a new entry
204
- $data = kubectl create secret generic temp --from-file=my-server-ca.crl=./my-server-ca.crl --dry-run=client -o jsonpath=' {.data}'
205
- kubectl patch secret aio-opc-ua-broker-issuer-list -n azure-iot-operations -p " {` " data` " : $data }"
206
- ` ` `
207
-
208
- ---
209
-
210
148
## Configure your OPC UA server
211
149
212
150
To complete the configuration of the application authentication mutual trust, you need to configure your OPC UA server to trust the connector for OPC UA application instance certificate:
@@ -260,9 +198,13 @@ Like the previous examples, you use a dedicated Kubernetes secret to store the c
260
198
# Create aio-opc-ua-broker-client-certificate secret
261
199
# Upload OPC UA public key certificate as an entry to the secret
262
200
# Upload OPC UA private key certificate as an entry to the secret
263
- kubectl create secret generic aio-opc-ua-broker-client-certificate -n azure-iot-operations \
264
- --from-file=opcuabroker-certificate.der=./opcuabroker-certificate.der \
265
- --from-file=opcuabroker-certificate.pem=./opcuabroker-certificate.pem
201
+ az iot ops connector opcua client add \
202
+ --instance $INSTANCE_NAME \
203
+ -g $RESOURCE_GROUP \
204
+ --public-key-file "./opcuabroker-certificate.der" \
205
+ --private-key-file "./opcuabroker-certificate.pem" \
206
+ --subject-name <subject name from the public key cert> \
207
+ --application-uri <application uri from the public key cert>
266
208
```
267
209
268
210
# [PowerShell](#tab/powershell)
@@ -271,76 +213,25 @@ Like the previous examples, you use a dedicated Kubernetes secret to store the c
271
213
# Create aio-opc-ua-broker-client-certificate secret
272
214
# Upload OPC UA public key certificate as an entry to the secret
273
215
# Upload OPC UA private key certificate as an entry to the secret
274
- kubectl create secret generic aio-opc-ua-broker-client-certificate -n azure-iot-operations `
275
- --from-file=opcuabroker-certificate.der=./opcuabroker-certificate.der `
276
- --from-file=opcuabroker-certificate.pem=./opcuabroker-certificate.pem
216
+ az iot ops connector opcua client add `
217
+ --instance $INSTANCE_NAME `
218
+ -g $RESOURCE_GROUP `
219
+ --public-key-file "./opcuabroker-certificate.der" `
220
+ --private-key-file "./opcuabroker-certificate.pem" `
221
+ --subject-name <subject name from the public key cert> `
222
+ --application-uri <application uri from the public key cert>
277
223
```
278
224
279
225
---
280
226
281
227
2. If you use the CA to issue certificates for your OPC UA broker, configure the *aio-opc-ua-broker-issuer-list* secret. Use a Kubernetes client such as `kubectl` to configure the secrets *enterprise-grade-ca-1.der* and *enterprise-grade-ca-1.crl*:
282
228
283
- # [Bash](#tab/bash)
284
-
285
-
286
- ` ` ` bash
229
+ ```azurecli
287
230
# Append CA certificate to the issuer list secret as a new entry
288
- data=$( kubectl create secret generic temp --from-file=enterprise-grade-ca-1.der=./enterprise-grade-ca-1.der --dry-run=client -o jsonpath=' {.data}' )
289
- kubectl patch secret aio-opc-ua-broker-issuer-list -n azure-iot-operations -p " {` " data` " : $data }"
231
+ az iot ops connector opcua issuer add --instance $INSTANCE_NAME --resource-group $RESOURCE_GROUP --certificate-file "./enterprise-grade-ca-1.der"
290
232
291
233
# Append the CRL to the issuer list secret as a new entry
292
- data=$( kubectl create secret generic temp --from-file= enterprise-grade-ca-1.crl=./enterprise-grade-ca-1.crl --dry-run=client -o jsonpath=' {.data}' )
293
- kubectl patch secret aio-opc-ua-broker-issuer-list -n azure-iot-operations -p " {` " data` " : $data }"
234
+ az iot ops connector opcua issuer add --instance $INSTANCE_NAME --resource-group $RESOURCE_GROUP --certificate-file "./enterprise-grade-ca-1.crl"
294
235
```
295
236
296
- # [PowerShell](#tab/powershell)
297
-
298
- ` ` ` powershell
299
- # Append CA certificate to the issuer list secret as a new entry
300
- $data = kubectl create secret generic temp --from-file=enterprise-grade-ca-1.der=./enterprise-grade-ca-1.der --dry-run=client -o jsonpath=' {.data}'
301
- kubectl patch secret aio-opc-ua-broker-issuer-list -n azure-iot-operations -p " {` " data` " : $data }"
302
-
303
- # Append the CRL to the issuer list secret as a new entry
304
- $data = kubectl create secret generic temp --from-file=enterprise-grade-ca-1.crl=./enterprise-grade-ca-1.crl --dry-run=client -o jsonpath=' {.data}'
305
- kubectl patch secret aio-opc-ua-broker-issuer-list -n azure-iot-operations -p " {` " data` " : $data }"
306
- ` ` `
307
-
308
- ---
309
-
310
- 1. Update the connector for OPC UA deployment to use the new ` secret` source for application instance certificates by using the following command:
311
-
312
- # [Bash](#tab/bash)
313
-
314
- ` ` ` bash
315
- az k8s-extension update \
316
- --version 0.7.0-preview \
317
- --name azure-iot-operations-qlll2 \
318
- --release-train preview \
319
- --cluster-name < cluster-name> \
320
- --resource-group < azure-resource-group> \
321
- --cluster-type connectedClusters \
322
- --auto-upgrade-minor-version false \
323
- --config connectors.values.securityPki.applicationCert=aio-opc-ua-broker-client-certificate \
324
- --config connectors.values.securityPki.subjectName=< subjectName> \
325
- --config connectors.values.securityPki.applicationUri=< applicationUri>
326
- ` ` `
327
-
328
- # [PowerShell](#tab/powershell)
329
-
330
- ` ` ` powershell
331
- az k8s-extension update `
332
- --version 0.7.0-preview `
333
- --name azure-iot-operations-qlll2 `
334
- --release-train preview `
335
- --cluster-name < cluster-name> `
336
- --resource-group <azure-resource-group> `
337
- --cluster-type connectedClusters `
338
- --auto-upgrade-minor-version false `
339
- --config connectors.values.securityPki.applicationCert=aio-opc-ua-broker-client-certificate `
340
- --config connectors.values.securityPki.subjectName=<subjectName> `
341
- --config connectors.values.securityPki.applicationUri=< applicationUri>
342
- ` ` `
343
-
344
- ---
345
-
346
237
Now that the connector for OPC UA uses the enterprise certificate, don't forget to add the new certificate's public key to the trusted certificate lists of all OPC UA servers it needs to connect to.
0 commit comments