Is it possible to push data to azure iot hub without an authorization header? Also, is it possible to add authorization header to url? My problem is that I am not able to add an autohrization header, so I need to post data without this header.
2 Answers
All connections to an Azure IoT Hub must be secured. For information about how to do this using the different protocols that IoT Hub supports for device connections, please take a look at: https://azure.microsoft.com/documentation/articles/iot-hub-devguide/#security
If there is no way for your device to add authorization headers, you should consider using a field gateway that sits between your devices and your hub. You can use a field gateway to add the necessary authorisation to a request on behalf of your device - for more information see https://azure.microsoft.com/documentation/articles/iot-hub-gateway-sdk-physical-device/
You can also use x509 certificates to authenticate your device with IoT Hub. See https://azure.microsoft.com/en-us/documentation/articles/iot-hub-sas-tokens/
Basically, you create a certificate and key, drop those on the device, insert the thumbprint of the certificate in the device registry, and then in your device code use the certificate instead of setting the Authorization header.
Also, have you looked if any of the SDKs provided for IoT Hub? These ought to simplify connecting your device to Azure quite a bit by handling authentication for you. You can find the SDKs on Github at: https://github.com/azure/azure-iot-sdks