简体   繁体   中英

how to register device to azure iot hub from device(with iot client c sdk)

I couldn't connect my iot device to azure iot hub to register device. I saw some example in node.js and c# sharp client sdk. But I couldn't find for c sdk. Is it possible register device (obtain credential) from client side? How can I connect my device to iot hub?

I tried to use this code: https://github.com/Azure/azure-iot-sdk-c/blob/master/iothub_client/samples/iothub_client_sample_mqtt/iothub_client_sample_mqtt.c

Also I used this article for help: https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-device-sdk-c-intro

Very important: you don't want a device to create a new identity on its own in IoT Hub as that would mean that the device has credentials to manage the IoT Hub instance. This is a considerable security risk.

This is one of the main reason why we have 2 types of SDKs: service client SDKs and device client SDKs.

The service client SDKs are meant to be used in back-end applications that will manage the Hub, while the device client SDKs are meant to be used on devices. This allows to keep control of your IoT solution and prevent a rogue compromised device to start messing around with the other devices or your data. You can actually find a C service client SDK in the C SDK repo under the folder "service" if you want to develop a back-end or management application in C.

Now, all that said, what it seems you are actually looking for is for a secure auto-registration mechanism, which is something we don't have yet on Azure IoT Hub. You can actually vote this feature up on uservoice here , as we are using this to help prioritize the upcoming features of the service.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM