Your description of what you did is not clear, and your question is too broad for SO. Based on my understanding for your description, I can only give some idea for you.
-
To turn LED on/off, you need a micro board as a controller, such as Arduino or Raspberry Pi, to receive the switching signal to control a relay which connect LED with Power Supply, or directly to switch the 3.3V/5V port of the board which connect LED if the LED is enough small.
-
For micro board device with Azure IoT Hub as below.
- Using Arduino in C/C++ to send device-to-cloud message as heartbeat to Azure IoT Hub for keeping connection & online status, then be ready for receving cloud-to-device message as switching signal from Azure IoT Hub to do the action for switching LED.
- Using Respberry Pi in Java with Oracle JDK for Linux ARM) or in C# on Windows IoT Core to do the same operations like Arduino above.
-
Using Java to build a application for User Interface to communicate with Azure IoT Hub to send cloud-to-device messages and check these device status.
There are some sample which you can refer to, but not for Java.
- Change the on and off behavior of the LED on Arduino.
- Connect your Raspberry Pi 3 device to your IoT hub using C and Node.js
- Connect your Intel Edison device to your IoT hub using Node.js and C
Hope it helps. Any concern, please feel free to let me know if you can improve your description.