How to send message to device after provisioning with mqtt x509?

Hop Vu 31 Reputation points
2020-12-14T04:08:53.183+00:00

I'm using the azure_sdk_for_c to provisioning with Azure it hub following the example paho_iot_provisioning_sample. I can successfully get the Hub Hostname and device ID from DPS but I don't know how to publish a message to the device. May I need to disconnect to DPS and make a direct connection to the IoT hub after that? And in this case, May I use the same certificate with DPS?

Azure IoT Hub
Azure IoT Hub
An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.
1,198 questions
0 comments No comments
{count} votes

Accepted answer
  1. António Sérgio Azevedo 7,666 Reputation points Microsoft Employee
    2020-12-14T12:39:52.253+00:00

    Hello @Hop Vu ,
    Welcome to Microsoft Q&A and thank you for your question!

    If you are following the samples as described here: https://github.com/Azure/azure-sdk-for-c/blob/master/sdk/samples/iot/README.md

    1) Can you confirm that you completed all prerequisites?

    DPS is used to register your device on a linked IoT Hub. Therefore the D2C and C2D messages will be done at the IoTHub level already created in your Azure Subscription.

    See the following doc for better understanding: Provisioning devices with Azure IoT Hub Device Provisioning Service

    47964-image.png

    Thank you!

    Remember:

    • Please accept an answer if correct. Original posters help the community find answers faster by identifying the correct answer. Here is how.
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.