Your best bet is probably to avoid the IoT SDKs since they can be a little memory hungry. You should simply use the raw MQTT protocol to talk to the hub. How to do this is documented here: https://learn.microsoft.com/en-us/azure/iot/iot-mqtt-connect-to-iot-hub#using-the-mqtt-protocol-directly-as-a-device. I did this once but for the sake of full disclosure, I have not looked at this code for some years. It may still be a useful starting point though: https://github.com/markrad/Azure-IoT-ESP8266