Skip to content
| Marketplace
Sign in
Visual Studio>Templates>Azure IoT Hub Sample of Device Simulation
Azure IoT Hub Sample of Device Simulation

Azure IoT Hub Sample of Device Simulation

Erich Wang(MSFT)

|
5,551 installs
| (1) | Free
Azure IoT Hub Sample of Device Simulation
Download

Project Template of Azure IoT Hub Sample

This project template will help you generate Azure IoT Hub sample code, the sample code demonstrates how to interact with Azure IoT Hub by simulating device with your Windows PC/Laptop, including creating device, sending D2C, receiving D2C on behalf of IoT Hub.

 

Prerequisite

You must create Azure IoT Hub first, the instruction is available at https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-csharp-csharp-getstarted#create-an-iot-hub

 

How to use the extension

After installing extension, you may follow the instructions below:

1. New C# project with template AzureIoTHubSample


2. Input correct connectString in AzureIoTHub.cs, the connect string could be found in Azure IoT Hub -> Shared access policies -> iothubowner -> Connection String

3. Build and run create device sample, the device with name "myFirstDevice" will be created

4. Input correct deviceConnectionString, the device could be got from Azure IoT Hub -> Devices -> select {your device name } -> Connection string in right panel

5. In Program.cs, uncomment send D2C code as follow

6. Build project and you can run sample code for sending/receive D2C messags.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft