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
If your EMQX server uses a certificate from a public CA (like Let's Encrypt), this step is not needed as the CA is already trusted by the system.
174
+
:::
175
+
147
176
### Update Device Client Code
148
177
149
178
The Azure IoT SDK for Python (and other languages) supports connecting to custom MQTT brokers through the `server_verification_cert` and custom `hostname` parameters. This allows for minimal code changes.
hostname="mqtt.example.com", # EMQX hostname instead of Azure
166
199
device_id="device-001",
167
-
server_verification_cert="certs/emqx-server-ca.pem"#EMQX server CA
200
+
server_verification_cert=emqx_server_ca#CA cert content as string
168
201
)
169
202
170
203
# Connect and use as before
171
204
client.connect()
172
205
client.send_message("Hello from migrated device")
173
206
```
174
207
208
+
::: tip
209
+
The `server_verification_cert` parameter expects the certificate **content as a string**, not a file path. If you've added the EMQX server CA to your system's trusted certificate store (recommended), you can omit this parameter and let the system handle verification.
0 commit comments