Skip to content

Commit 214a7a5

Browse files
Merge pull request #263081 from jlian/main
Correct EH Kafka connector docs
2 parents 494f8a1 + 588a418 commit 214a7a5

File tree

2 files changed

+101
-22
lines changed

2 files changed

+101
-22
lines changed

articles/iot-operations/connect-to-cloud/howto-configure-kafka.md

Lines changed: 91 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ ms.subservice: mq
88
ms.topic: how-to
99
ms.custom:
1010
- ignite-2023
11-
ms.date: 11/15/2023
11+
ms.date: 01/16/2024
1212

1313
#CustomerIntent: As an operator, I want to understand how to configure Azure IoT MQ to send and receive messages between Azure IoT MQ and Kafka.
1414
---
1515

16-
# Send and receive messages between Azure IoT MQ and Kafka
16+
# Send and receive messages between Azure IoT MQ and Event Hubs or Kafka
1717

1818
[!INCLUDE [public-preview-note](../includes/public-preview-note.md)]
1919

@@ -180,9 +180,9 @@ The `tls` field enables TLS encryption for the connection and optionally specifi
180180
| Field | Description | Required |
181181
| ----- | ----------- | -------- |
182182
| tlsEnabled | A boolean value that indicates whether TLS encryption is enabled or not. It must be set to true for Event Hubs communication. | Yes |
183-
| caConfigMap | The name of the config map that contains the CA certificate for verifying the server's identity. This field isn't required for Event Hubs communication, as Event Hubs uses well-known CAs that are trusted by default. However, you can use this field if you want to use a custom CA certificate. | No |
183+
| trustedCaCertificateConfigMap | The name of the config map that contains the CA certificate for verifying the server's identity. This field isn't required for Event Hubs communication, as Event Hubs uses well-known CAs that are trusted by default. However, you can use this field if you want to use a custom CA certificate. | No |
184184

185-
When specifying a trusted CA is required, create a ConfigMap containing the public potion of the CA in PEM format, and specify the name in the `caConfigMap` property.
185+
When specifying a trusted CA is required, create a ConfigMap containing the public potion of the CA in PEM format, and specify the name in the `trustedCaCertificateConfigMap` property.
186186

187187
```bash
188188
kubectl create configmap ca-pem --from-file path/to/ca.pem
@@ -201,36 +201,114 @@ The authentication field supports different types of authentication methods, suc
201201

202202
| Field | Description | Required |
203203
| ----- | ----------- | -------- |
204-
| sasl | The configuration for SASL authentication. Specify the `saslType`, which can be *plain*, *scram-sha-256*, or *scram-sha-512*, and the `secretName` to reference the Kubernetes secret containing the username and password. | Yes, if using SASL authentication |
205-
| x509 | The configuration for X509 authentication. Specify the `secretName` field. The `secretName` field is the name of the secret that contains the client certificate and the client key in PEM format, stored as a TLS secret. | Yes, if using X509 authentication |
204+
| sasl | The configuration for SASL authentication. Specify the `saslType`, which can be *plain*, *scramSha256*, or *scramSha512*, and `token` to reference the Kubernetes `secretName` or Azure Key Vault `keyVault` secret containing the password. | Yes, if using SASL authentication |
206205
| systemAssignedManagedIdentity | The configuration for managed identity authentication. Specify the audience for the token request, which must match the Event Hubs namespace (`https://<NAMESPACE>.servicebus.windows.net`) [because the connector is a Kafka client](/azure/event-hubs/authenticate-application). A system-assigned managed identity is automatically created and assigned to the connector when it's enabled. | Yes, if using managed identity authentication |
206+
| x509 | The configuration for X509 authentication. Specify the `secretName` or `keyVault` field. The `secretName` field is the name of the secret that contains the client certificate and the client key in PEM format, stored as a TLS secret. | Yes, if using X509 authentication |
207207

208-
You can use Azure Key Vault to manage secrets for Azure IoT MQ instead of Kubernetes secrets. To learn more, see [Manage secrets using Azure Key Vault or Kubernetes secrets](../manage-mqtt-connectivity/howto-manage-secrets.md).
208+
To learn how to use Azure Key Vault and the `keyVault` to manage secrets for Azure IoT MQ instead of Kubernetes secrets, see [Manage secrets using Azure Key Vault or Kubernetes secrets](../manage-mqtt-connectivity/howto-manage-secrets.md).
209209

210-
For Event Hubs, use plain SASL and `$ConnectionString` as the username and the full connection string as the password.
210+
##### Authenticate to Event Hubs
211+
212+
To connect to Event Hubs using a connection string and Kubernetes secret, use `plain` SASL type and `$ConnectionString` as the username and the full connection string as the password. First create the Kubernetes secret:
211213

212214
```bash
213-
kubectl create secret generic cs-secret \
215+
kubectl create secret generic cs-secret -n azure-iot-operations \
214216
--from-literal=username='$ConnectionString' \
215217
--from-literal=password='Endpoint=sb://<NAMESPACE>.servicebus.windows.net/;SharedAccessKeyName=<KEY_NAME>;SharedAccessKey=<KEY>'
216218
```
217219

220+
Then, reference the secret in the configuration:
221+
222+
```yaml
223+
authentication:
224+
enabled: true
225+
authType:
226+
sasl:
227+
saslType: plain
228+
token:
229+
secretName: cs-secret
230+
```
231+
232+
To use Azure Key Vault instead of Kubernetes secrets, create an Azure Key Vault secret with the connection string `Endpoint=sb://..`, reference it with `vaultSecret`, and specify the username as `"$ConnectionString"` in the configuration.
233+
234+
```yaml
235+
authentication:
236+
enabled: true
237+
authType:
238+
sasl:
239+
saslType: plain
240+
token:
241+
keyVault:
242+
username: "$ConnectionString"
243+
vault:
244+
name: my-key-vault
245+
directoryId: <AKV directory ID>
246+
credentials:
247+
servicePrincipalLocalSecretName: aio-akv-sp
248+
vaultSecret:
249+
name: my-cs # Endpoint=sb://..
250+
# version: 939ecc2...
251+
```
252+
253+
To use managed identity, specify it as the only method under authentication. You also need to assign a role to the managed identity that grants permission to send and receive messages from Event Hubs, such as Azure Event Hubs Data Owner or Azure Event Hubs Data Sender/Receiver. To learn more, see [Authenticate an application with Microsoft Entra ID to access Event Hubs resources](/azure/event-hubs/authenticate-application#built-in-roles-for-azure-event-hubs).
254+
255+
```yaml
256+
authentication:
257+
enabled: true
258+
authType:
259+
systemAssignedManagedIdentity:
260+
audience: https://<NAMESPACE>.servicebus.windows.net
261+
```
262+
263+
##### X.509
264+
218265
For X.509, use Kubernetes TLS secret containing the public certificate and private key.
219266

220267
```bash
221-
kubectl create secret tls my-tls-secret \
268+
kubectl create secret tls my-tls-secret -n azure-iot-operations \
222269
--cert=path/to/cert/file \
223270
--key=path/to/key/file
224271
```
225272

226-
To use managed identity, specify it as the only method under authentication. You also need to assign a role to the managed identity that grants permission to send and receive messages from Event Hubs, such as Azure Event Hubs Data Owner or Azure Event Hubs Data Sender/Receiver. To learn more, see [Authenticate an application with Microsoft Entra ID to access Event Hubs resources](/azure/event-hubs/authenticate-application#built-in-roles-for-azure-event-hubs).
273+
Then specify the `secretName` in configuration.
227274

228275
```yaml
229276
authentication:
230277
enabled: true
231278
authType:
232-
systemAssignedManagedIdentity:
233-
audience: https://<NAMESPACE>.servicebus.windows.net
279+
x509:
280+
secretName: my-tls-secret
281+
```
282+
283+
To use Azure Key Vault instead, make sure the [certificate and private key are properly imported](../../key-vault/certificates/tutorial-import-certificate.md) and then specify the reference with `vaultCert`.
284+
285+
```yaml
286+
authentication:
287+
enabled: true
288+
authType:
289+
x509:
290+
keyVault:
291+
vault:
292+
name: my-key-vault
293+
directoryId: <AKV directory ID>
294+
credentials:
295+
servicePrincipalLocalSecretName: aio-akv-sp
296+
vaultCert:
297+
name: my-cert
298+
# version: 939ecc2...
299+
## If presenting full chain also
300+
# vaultCaChainSecret:
301+
# name: my-chain
302+
```
303+
304+
Or, if presenting the full chain is required, upload the full chain cert and key to AKV as a PFX file and use the `vaultCaChainSecret` field instead.
305+
306+
```yaml
307+
# ...
308+
keyVault:
309+
vaultCaChainSecret:
310+
name: my-cert
311+
# version: 939ecc2...
234312
```
235313

236314
### Manage local broker connection

articles/iot-operations/manage-mqtt-connectivity/howto-manage-secrets.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ms.subservice: mq
88
ms.topic: how-to
99
ms.custom:
1010
- ignite-2023
11-
ms.date: 11/15/2023
11+
ms.date: 01/16/2024
1212

1313
#CustomerIntent: As an operator, I want to configure IoT MQ to use Azure Key Vault or Kubernetes secrets so that I can securely manage secrets.
1414
---
@@ -55,15 +55,16 @@ The `keyVault` field is available wherever Kubernetes secrets (`secretName`) are
5555
| vaultCert | Yes, when using Key Vault certificates | Specifies the certificate in the Azure Key Vault. |
5656
| vaultCert.name | Yes | Specifies the name of the certificate secret. |
5757
| vaultCert.version | No | Specifies the version of the certificate secret. |
58-
| vaultCaChainCert | Yes, when using certificate chain | Specifies the certificate chain in the Azure Key Vault. |
59-
| vaultCaChainCert.name | Yes | Specifies the name of the certificate chain. |
60-
| vaultCaChainCert.version | No | Specifies the version of the certificate chain. |
58+
| vaultCaChainSecret | Yes, when using certificate chain | Specifies the certificate chain in the Azure Key Vault. |
59+
| vaultCaChainSecret.name | Yes | Specifies the name of the certificate chain. |
60+
| vaultCaChainSecret.version | No | Specifies the version of the certificate chain. |
61+
| username | No | Used only for Event Hubs Kafka connector, see [Send and receive messages between Azure IoT MQ and Event Hubs or Kafka](../connect-to-cloud/howto-configure-kafka.md). |
6162

6263
The type of secret you're using determines which of the following fields you can use:
6364

6465
- `vaultSecret`: Use this field when you're using a regular secret. For example, you can use this field for configuring a *BrokerAuthentication* resource with the `usernamePassword` field.
6566
- `vaultCert`: Use this field when you're using the certificate type secret with client certificate and key. For example, you can use this field for enabling TLS on a *BrokerListener*.
66-
- `vaultCaChainCert`: Use this field when you're using a regular Key Vault secret that contains the CA chain of the client certificate. This field is for when you need IoT MQ to present the CA chain of the client certificate to a remote connection. For example, you can use this field for configuring a *MqttBridgeConnector* resource with the `remoteBrokerConnection` field.
67+
- `vaultCaChainSecret`: Use this field when you need to present a full certificate chain, with all extra intermediate or root certificates, to the remote server. For example, you can use this field for configuring a *MqttBridgeConnector* resource with the `remoteBrokerConnection` field. To use this field, import X.509 certificates without private keys in PEM format as a multi-line regular secret (not certificate-type) to Key Vault. This field should be used in addition to `vaultCert` that has the client certificate and private key.
6768

6869
## Examples
6970

@@ -89,7 +90,7 @@ spec:
8990
servicePrincipalLocalSecretName: aio-akv-sp
9091
vaultCert:
9192
name: my-server-certificate
92-
version: latest
93+
# version: 939ecc2...
9394
```
9495

9596
This next example shows how to use Azure Key Vault for the `usernamePassword` field in a BrokerAuthentication resource:
@@ -113,7 +114,7 @@ spec:
113114
servicePrincipalLocalSecretName: aio-akv-sp
114115
vaultSecret:
115116
name: my-username-password-db
116-
version: latest
117+
# version: 939ecc2...
117118
```
118119

119120
This example shows how to use Azure Key Vault for MQTT bridge remote broker credentials:
@@ -144,9 +145,9 @@ spec:
144145
directoryId: <AKV directory ID>
145146
credentials:
146147
servicePrincipalLocalSecretName: aio-akv-sp
147-
vaultCaChainCert:
148+
vaultCaChainSecret:
148149
name: my-remote-broker-certificate
149-
version: latest
150+
# version: 939ecc2...
150151
```
151152

152153
## Related content

0 commit comments

Comments
 (0)