You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. TheMQTTclientoptionsareconfiguredusingthe `MqttClientOptions` class. Usingthe `MqttClientOptionsBuilder` asadvisedinthe [client](https://github.com/dotnet/MQTTnet/wiki/Client) documentation is the advised way of setting the options:
44
42
45
43
```csharp
46
-
// Create TCP based options using the builder amd connect to broker
Console.WriteLine("The MQTT client published a message.");
71
66
```
72
67
73
68
## Pod specification
74
69
75
-
The `serviceAccountName` fieldinthepodconfigurationmustmatchtheserviceaccountassociatedwiththetokenbeingused. Also, notethe `serviceAccountToken.expirationSeconds` issetto **86400 seconds**, andonceitexpires, youneedtoreloadthetokenfromdisk. Thislogicisn't currently implemented in the sample.
70
+
The `serviceAccountName` fieldinthepodconfigurationmustmatchtheserviceaccountassociatedwiththetokenbeingused. Also, notethe `serviceAccountToken.expirationSeconds` issetto **86400 seconds**, andonceitexpires, youneedtoreloadthetokenfromdisk. Thislogicisn't implemented in this sample.
76
71
77
72
```yaml
78
73
apiVersion:v1
74
+
kind:ServiceAccount
75
+
metadata:
76
+
name:mqtt-client
77
+
namespace:azure-iot-operations
78
+
79
+
---
80
+
apiVersion:v1
79
81
kind:Pod
80
82
metadata:
81
83
name:mqtt-client-dotnet
82
-
labels:
83
-
app:publisher
84
+
namespace:azure-iot-operations
84
85
spec:
85
86
serviceAccountName:mqtt-client
86
87
87
-
volumes:
88
-
# SAT token used to authenticate between the application and the MQTT broker
89
-
-name:mqtt-client-token
90
-
projected:
91
-
sources:
92
-
-serviceAccountToken:
93
-
path:mqtt-client-token
94
-
audience:aio-mq-dmqtt
95
-
expirationSeconds:86400
96
-
97
-
# Certificate chain for the application to validate the MQTT broker
98
-
-name:aio-mq-ca-cert-chain
99
-
configMap:
100
-
name:aio-mq-ca-cert-chain
88
+
volumes:
89
+
90
+
# SAT token used to authenticate between the application and the MQTT broker
91
+
-name:mqtt-client-token
92
+
projected:
93
+
sources:
94
+
-serviceAccountToken:
95
+
path:mqtt-client-token
96
+
audience:aio-mq
97
+
expirationSeconds:86400
98
+
99
+
# Certificate chain for the application to validate the MQTT broker
The token is mounted into the container at the path specified in `containers[].volumeMount.mountPath`
121
-
122
125
To run the sample, follow the instructions in its [README](https://github.com/Azure-Samples/explore-iot-operations/tree/main/samples/mqtt-client-dotnet).
0 commit comments