Skip to content

Commit b1e7056

Browse files
Merge pull request #289310 from dominicbetts/release-aio-m3-cert-management
AIO [M3]: Update cert management for CLI
2 parents d3ea9f1 + 92fad32 commit b1e7056

File tree

1 file changed

+34
-143
lines changed

1 file changed

+34
-143
lines changed

articles/iot-operations/discover-manage-assets/howto-configure-opcua-certificates-infrastructure.md

Lines changed: 34 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ To learn more, see [OPC UA certificates infrastructure for the connector for OPC
2424

2525
## Prerequisites
2626

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)
2830

2931
## Configure a self-signed application instance certificate
3032

@@ -43,44 +45,20 @@ To connect to an asset, first you need to establish the application authenticati
4345
4446
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.
4547

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-
6648
For a DER encoded certificate in a file such as *./my-server.der*, run the following command:
6749

68-
```powershell
50+
```azurecli
6951
# 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"
7253
```
7354
7455
For a PEM encoded certificate in a file such as *./my-server.crt*, run the following command:
7556
76-
```powershell
57+
```azurecli
7758
# 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"
8060
```
8161
82-
---
83-
8462
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.
8563
8664
To trust a CA, complete the following steps:
@@ -95,8 +73,7 @@ To trust a CA, complete the following steps:
9573
9674
```bash
9775
# 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"
10077
10178
# Append the CRL to the trusted certificate list secret as a new entry
10279
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:
10784
10885
```bash
10986
# 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"
11288
11389
# Append the CRL to the trusted certificates list secret as a new entry
11490
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:
12197
12298
```powershell
12399
# 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"
126101
127102
# Append the CRL to the trusted certificate list secret as a new entry
128103
$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:
133108
134109
```powershell
135110
# 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"
138112
139113
# Append the CRL to the trusted certificate list secret as a new entry
140114
$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
153127
154128
1. Save the CA certificate and the CRL in the `aio-opc-ua-broker-issuer-list` secret.
155129
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
161131
# 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"
164133
165134
# 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"
168136
```
169137
170138
For a PEM encoded certificate in a file such as *./my-server-ca.crt*, run the following commands:
171139
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
187141
# 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"
190143
191144
# 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"
194146
```
195147
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-
210148
## Configure your OPC UA server
211149
212150
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
260198
# Create aio-opc-ua-broker-client-certificate secret
261199
# Upload OPC UA public key certificate as an entry to the secret
262200
# 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>
266208
```
267209
268210
# [PowerShell](#tab/powershell)
@@ -271,76 +213,25 @@ Like the previous examples, you use a dedicated Kubernetes secret to store the c
271213
# Create aio-opc-ua-broker-client-certificate secret
272214
# Upload OPC UA public key certificate as an entry to the secret
273215
# 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>
277223
```
278224
279225
---
280226
281227
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*:
282228
283-
# [Bash](#tab/bash)
284-
285-
286-
```bash
229+
```azurecli
287230
# 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"
290232
291233
# 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"
294235
```
295236
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-
346237
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

Comments
 (0)