How do I receive data uploaded by my device in the iot hub?

氏 宋 0 Reputation points
2023-12-15T02:48:47.98+00:00

How do I receive data uploaded by my device in the iot hub?

For example, do I need to emulate an device client on my application server and focus on the subject of the device emitting data?

Is there a way for iot hubs to forward device to cloud data to one of my web api services?

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

2 answers

Sort by: Most helpful
  1. Sander van de Velde | MVP 36,526 Reputation points MVP Volunteer Moderator
    2023-12-15T08:18:12.4333333+00:00

    Hello @氏 宋,

    welcome to this moderated Azure community forum.

    As @Sedat SALMAN already explained, the Azure IoT Hub is your cloud gateway where devices can send data to in a secure way using their own identity. Over the same communication channel devices can receive custom messages from the cloud to react on.

    If you want to connect logic to the IoT Hub, you need to register a device identity and use it in your custom code.

    The easiest way to start is using device SDKs for languages like Python or C#.

    Incoming messages can automatically be routed to other Azure services like blob storage, CosmosDB, EventHub etc.

    Check out these free MS Learn training modules about eg. IoT Hub or connecting a device.


    If the response helped, do "Accept Answer". If it doesn't work, please let us know the progress. All community members with similar issues will benefit by doing so. Your contribution is highly appreciated.

    1 person found this answer helpful.
    0 comments No comments

  2. Sedat SALMAN 14,170 Reputation points MVP
    2023-12-15T06:57:40.91+00:00

    Your device, like a chatty friend, sends messages packed with valuable information to Azure IoT Hub, the central hub of your cloud connection. Think of it as a bustling town square where all device chatter gets collected.

    • It uses protocols like MQTT, AMQP, or even custom ones to send its messages. Remember, security is key, so make sure your device has proper encryption and authentication like a secret handshake.
    • Every message from your device arrives at the Hub, eager to be directed to the right place. Think of it as a mail sorter with a magical understanding of device data.
    • You set up routing rules, like instructions, telling the Hub where to send each message. Is it urgent data for your Web API, like a hot tip for a friend? Send it directly! Does it need some processing or filtering first? The Hub can send it to an Azure Service Bus, like a temporary stop-over for organizing the information.
    • Finally, the data reaches your Web API, the heart of your application. Think of it as a friend finally receiving the juicy gossip! It can then analyze the data, trigger actions, or do whatever magic you've programmed it to do

    As a note

    • No need to mimic your device on your server, let the Hub handle the delivery!
    • Use subject fields or device IDs like labels on the messages to ensure they reach the right destination.
    • Don't hesitate to choose the delivery method that fits your needs - express delivery for urgent data, or a sorting center for more complex processing.
    0 comments No comments

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.