Skip to content

Commit c614e10

Browse files
Merge pull request #292737 from PatAltimore/patricka-todo
Add content to replace to do comments
2 parents a3aa2a8 + 3840891 commit c614e10

File tree

1 file changed

+32
-48
lines changed

1 file changed

+32
-48
lines changed

articles/iot-operations/connect-to-cloud/tutorial-mqtt-bridge.md

Lines changed: 32 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ms.author: patricka
66
ms.service: azure-iot-operations
77
ms.subservice: azure-data-flows
88
ms.topic: tutorial
9-
ms.date: 11/25/2024
9+
ms.date: 01/07/2025
1010

1111
#CustomerIntent: As an operator, I want to understand how to create a bi-directional MQTT bridge to Azure Event Grid so that I can send and receive messages between devices and services.
1212
---
@@ -512,62 +512,26 @@ When you publish to the `tutorial/local` topic on the local Azure IoT Operations
512512

513513
## Deploy MQTT client
514514

515-
To verify the MQTT bridge is working, deploy an MQTT client to the same namespace as Azure IoT Operations. In a new file named `client.yaml`, specify the client deployment:
516-
517-
<!-- TODO: put this in the explore-iot-operations repo? -->
515+
To verify the MQTT bridge is working, deploy an MQTT client to the same namespace as Azure IoT Operations.
518516

519517
# [Bicep](#tab/bicep)
520518

521-
Currently, bicep doesn't apply to deploy MQTT client.
519+
Currently, Bicep doesn't apply to deploy MQTT client.
522520

523521
# [Kubernetes (preview)](#tab/kubernetes)
524522

525-
```yaml
526-
apiVersion: v1
527-
kind: ServiceAccount
528-
metadata:
529-
name: mqtt-client
530-
namespace: azure-iot-operations
531-
---
532-
apiVersion: v1
533-
kind: Pod
534-
metadata:
535-
name: mqtt-client
536-
# Namespace must match MQTT broker BrokerListener's namespace
537-
# Otherwise use the long hostname: aio-broker.azure-iot-operations.svc.cluster.local
538-
namespace: azure-iot-operations
539-
spec:
540-
# Use the "mqtt-client" service account from above
541-
# Otherwise create it with `kubectl create serviceaccount mqtt-client -n azure-iot-operations`
542-
serviceAccountName: mqtt-client
543-
containers:
544-
# Mosquitto and mqttui on Alpine
545-
- image: alpine
546-
name: mqtt-client
547-
command: ["sh", "-c"]
548-
args: ["apk add mosquitto-clients mqttui && sleep infinity"]
549-
volumeMounts:
550-
- name: broker-sat
551-
mountPath: /var/run/secrets/tokens
552-
- name: trust-bundle
553-
mountPath: /var/run/certs
554-
volumes:
555-
- name: broker-sat
556-
projected:
557-
sources:
558-
- serviceAccountToken:
559-
path: broker-sat
560-
audience: aio-internal # Must match audience in BrokerAuthentication
561-
expirationSeconds: 86400
562-
- name: trust-bundle
563-
configMap:
564-
name: azure-iot-operations-aio-ca-trust-bundle # Default root CA cert
565-
```
523+
Download `client.yaml` deployment from the GitHub sample repository.
524+
525+
> [!IMPORTANT]
526+
> Don't use the MQTT client in production. The client is for testing purposes only.
566527

528+
```bash
529+
wget https://raw.githubusercontent.com/Azure-Samples/explore-iot-operations/main/samples/quickstarts/mqtt-client.yaml -O mqtt-client.yaml
530+
```
567531
Apply the deployment file with kubectl.
568532

569533
```bash
570-
kubectl apply -f client.yaml
534+
kubectl apply -f mqtt-client.yaml
571535
```
572536

573537
```output
@@ -620,7 +584,27 @@ mosquitto_pub -h aio-broker -p 18883 \
620584

621585
In the subscriber shell, you see the messages you published.
622586

623-
<!-- TODO: add actual mosquitto output -->
587+
```Output
588+
Client null sending CONNECT
589+
Client $server-generated/0000aaaa-11bb-cccc-dd22-eeeeee333333 received CONNACK (0)
590+
Client $server-generated/0000aaaa-11bb-cccc-dd22-eeeeee333333 sending SUBSCRIBE (Mid: 1, Topic: tutorial/#, QoS: 0, Options: 0x00)
591+
Client $server-generated/0000aaaa-11bb-cccc-dd22-eeeeee333333 received SUBACK
592+
Subscribed (mid: 1): 0
593+
Client $server-generated/0000aaaa-11bb-cccc-dd22-eeeeee333333 sending PINGREQ
594+
Client $server-generated/0000aaaa-11bb-cccc-dd22-eeeeee333333 received PINGRESP
595+
Client $server-generated/0000aaaa-11bb-cccc-dd22-eeeeee333333 received PUBLISH (d0, q0, r0, m0, 'tutorial/local', ... (52 bytes))
596+
This message goes all the way to the cloud and back!
597+
Client $server-generated/0000aaaa-11bb-cccc-dd22-eeeeee333333 received PUBLISH (d0, q0, r0, m0, 'tutorial/local', ... (52 bytes))
598+
This message goes all the way to the cloud and back!
599+
Client $server-generated/0000aaaa-11bb-cccc-dd22-eeeeee333333 received PUBLISH (d0, q0, r0, m0, 'tutorial/local', ... (52 bytes))
600+
This message goes all the way to the cloud and back!
601+
Client $server-generated/0000aaaa-11bb-cccc-dd22-eeeeee333333 received PUBLISH (d0, q0, r0, m0, 'tutorial/local', ... (52 bytes))
602+
This message goes all the way to the cloud and back!
603+
Client $server-generated/0000aaaa-11bb-cccc-dd22-eeeeee333333 received PUBLISH (d0, q0, r0, m0, 'tutorial/local', ... (52 bytes))
604+
This message goes all the way to the cloud and back!
605+
Client $server-generated/0000aaaa-11bb-cccc-dd22-eeeeee333333 sending PINGREQ
606+
Client $server-generated/0000aaaa-11bb-cccc-dd22-eeeeee333333 received PINGRESP
607+
```
624608

625609
Here, you see the messages are published to the local Azure IoT Operations broker to the `tutorial/local` topic, bridged to Event Grid MQTT broker, and then bridged back to the local Azure IoT Operations broker again on the `tutorial/cloud` topic. The messages are then delivered to the subscriber. In this example, the round trip time is about 80 ms.
626610

0 commit comments

Comments
 (0)