@@ -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,18 @@ 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
- For a DER encoded certificate in a file such as * ./my-server.der* , run the following command:
67
-
68
- ` ` ` powershell
48
+ ``` azurecli
69
49
# 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 }"
50
+ az iot ops connector opcua trust add --instance $INSTANCE_NAME --resource-group $RESOURCE_GROUP --certificate-file "./my-server.der"
72
51
```
73
52
74
53
For a PEM encoded certificate in a file such as *./my-server.crt*, run the following command:
75
54
76
- ` ` ` powershell
55
+ ```azurecli
77
56
# 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 }"
57
+ az iot ops connector opcua trust add --instance $INSTANCE_NAME --resource-group $RESOURCE_GROUP --certificate-file "./my-server.crt"
80
58
```
81
59
82
- ---
83
-
84
60
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
61
86
62
To trust a CA, complete the following steps:
@@ -95,8 +71,7 @@ To trust a CA, complete the following steps:
95
71
96
72
```bash
97
73
# 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 }"
74
+ az iot ops connector opcua trust add --instance $INSTANCE_NAME --resource-group $RESOURCE_GROUP --certificate-file "./my-server-ca.der"
100
75
101
76
# Append the CRL to the trusted certificate list secret as a new entry
102
77
data=$(kubectl create secret generic temp --from-file= my-server-ca.crl=./ my-server-ca.crl --dry-run=client -o jsonpath='{.data}')
@@ -107,8 +82,7 @@ To trust a CA, complete the following steps:
107
82
108
83
```bash
109
84
# 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 }"
85
+ az iot ops connector opcua trust add --instance $INSTANCE_NAME --resource-group $RESOURCE_GROUP --certificate-file "./my-server-ca.crt"
112
86
113
87
# Append the CRL to the trusted certificates list secret as a new entry
114
88
data=$(kubectl create secret generic temp --from-file=my-server-ca.crl=./my-server-ca.crl --dry-run=client -o jsonpath='{.data}')
@@ -121,8 +95,7 @@ To trust a CA, complete the following steps:
121
95
122
96
```powershell
123
97
# 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 }"
98
+ az iot ops connector opcua trust add --instance $INSTANCE_NAME --resource-group $RESOURCE_GROUP --certificate-file "./my-server-ca.der"
126
99
127
100
# Append the CRL to the trusted certificate list secret as a new entry
128
101
$data = kubectl create secret generic temp --from-file=my-server-ca.crl=./my-server-ca.crl --dry-run=client -o jsonpath='{.data}'
@@ -133,8 +106,7 @@ To trust a CA, complete the following steps:
133
106
134
107
```powershell
135
108
# 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 }"
109
+ az iot ops connector opcua trust add --instance $INSTANCE_NAME --resource-group $RESOURCE_GROUP --certificate-file "./my-server-ca.crt"
138
110
139
111
# Append the CRL to the trusted certificate list secret as a new entry
140
112
$data = kubectl create secret generic temp --from-file=my-server-ca.crl=./my-server-ca.crl --dry-run=client -o jsonpath='{.data}'
@@ -153,60 +125,24 @@ If your OPC UA server uses a certificate issued by a CA, but you don't want to t
153
125
154
126
1. Save the CA certificate and the CRL in the `aio-opc-ua-broker-issuer-list` secret.
155
127
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
128
+ ```azurecli
161
129
# 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 }"
130
+ az iot ops connector opcua issuer add --instance $INSTANCE_NAME --resource-group $RESOURCE_GROUP --certificate-file "./my-server-ca.der"
164
131
165
132
# 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 }"
133
+ az iot ops connector opcua issuer add --instance $INSTANCE_NAME --resource-group $RESOURCE_GROUP --certificate-file "./my-server-ca.crl"
168
134
```
169
135
170
136
For a PEM encoded certificate in a file such as *./my-server-ca.crt*, run the following commands:
171
137
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
138
+ ```azurecli
187
139
# 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 }"
140
+ az iot ops connector opcua issuer add --instance $INSTANCE_NAME --resource-group $RESOURCE_GROUP --certificate-file "./my-server-ca.crt"
190
141
191
142
# 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 }"
143
+ az iot ops connector opcua issuer add --instance $INSTANCE_NAME --resource-group $RESOURCE_GROUP --certificate-file "./my-server-ca.crl"
194
144
```
195
145
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
146
## Configure your OPC UA server
211
147
212
148
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 +196,13 @@ Like the previous examples, you use a dedicated Kubernetes secret to store the c
260
196
# Create aio-opc-ua-broker-client-certificate secret
261
197
# Upload OPC UA public key certificate as an entry to the secret
262
198
# 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
199
+ az iot ops connector opcua client add \
200
+ --instance $INSTANCE_NAME \
201
+ -g $RESOURCE_GROUP \
202
+ --public-key-file "./opcuabroker-certificate.der" \
203
+ --private-key-file "./opcuabroker-certificate.pem" \
204
+ --subject-name <subject name from the public key cert> \
205
+ --application-uri <application uri from the public key cert>
266
206
```
267
207
268
208
# [PowerShell](#tab/powershell)
@@ -271,76 +211,25 @@ Like the previous examples, you use a dedicated Kubernetes secret to store the c
271
211
# Create aio-opc-ua-broker-client-certificate secret
272
212
# Upload OPC UA public key certificate as an entry to the secret
273
213
# 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
214
+ az iot ops connector opcua client add `
215
+ --instance $INSTANCE_NAME `
216
+ -g $RESOURCE_GROUP `
217
+ --public-key-file "./opcuabroker-certificate.der" `
218
+ --private-key-file "./opcuabroker-certificate.pem" `
219
+ --subject-name <subject name from the public key cert> `
220
+ --application-uri <application uri from the public key cert>
277
221
```
278
222
279
223
---
280
224
281
225
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
226
283
- # [Bash](#tab/bash)
284
-
285
-
286
- ` ` ` bash
227
+ ```azurecli
287
228
# 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 }"
229
+ az iot ops connector opcua issuer add --instance $INSTANCE_NAME --resource-group $RESOURCE_GROUP --certificate-file "./enterprise-grade-ca-1.der"
290
230
291
231
# 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 }"
232
+ az iot ops connector opcua issuer add --instance $INSTANCE_NAME --resource-group $RESOURCE_GROUP --certificate-file "./enterprise-grade-ca-1.crl"
294
233
```
295
234
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
235
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