0

I have been trying to connect with Azure IoT Central using the raspberry pico w. My proyect is a Metrology IoT Device which sense a bunch of enviromental parameters and sends the infromation using MQTT currently to a broker. I have set up the LWIP MQTT and Azure SDK but I am not sure of the following:

  1. Which enpoint shoud I use for the Azure IoT Central?
  2. If I am using a SAS token, do I need to have a CA certificate as well?
  3. The examples for the Azure SDK for C are either IoT Hub, Provisioning or telemetry which one should I use.

I am using this endoint: .azureiotcentral.com, and I have done the process of decode64->hmac->encode64 for the SASkey, along side the Azure SDK for C to get the username and passwords and I am using port 8883.

  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Aug 14 '23 at 10:23

1 Answers1

0
  1. IoT Central uses Azure Device Provisioning Service (DPS) under the hood. This global service assigns a device to an Azure IoT Hub (again, what IoT Central is built on). DPS has one job: returning an Azure IoT Hub endpoint for your device to connect. It does support MQTT, so you can connect to it to find out what IoT Hub you need to connect to. Alternatively, you can use the device SDKs. The endpoint for DPS is always the same: global.azure-devices-provisioning.net
  2. No, you do not! You need the endpoint, ID scope, Device ID and a key. But the device will need to trust the IoT Central certificate. There's nothing left to do when you're using the Azure IoT SDK. Any other connection stack: check this post.
  3. Provisioning. Because you need to connect to DPS. There used to be a workaround for this: you could use a console tool to resolve the IoT Hub endpoint instead. But with IoT Central, your assigned IoT Hub could change at any moment without warning, so please use DPS. Here's a sample using C.

Edit: included Roman's findings on MQTT support for DPS

Matthijs van der Veer
  • 3,865
  • 2
  • 12
  • 22
  • 1. - presently, the Azure DPS has a MQTT support, it's not a full-featured MQTT broker, see more details in the https://learn.microsoft.com/en-us/azure/iot/iot-mqtt-connect-to-iot-dps. It's working very well using the direct MQTT protocol. – Roman Kiss Aug 14 '23 at 12:16
  • @RomanKiss That MQTT support is new to me, but you would still need to then connect to the assigned IoT Hub, correct? DPS will return you the iot hub to connect to. – Matthijs van der Veer Aug 14 '23 at 14:30
  • basically it looks like it is a wrapper of the DPS MQTT Broker. There are $dps/registration/... built-in topics for publisher and subscriber to obtain a registrationState with assignedHub, etc. properties. – Roman Kiss Aug 14 '23 at 15:00