3

I want to create a device in the IoT Hub when I add a device in my application.

I'm looking for REST Endpoints available for performing operation. Or any SDK available to do this.

Samuel Philipp
  • 10,631
  • 12
  • 36
  • 56
Ramesh Gurusamy
  • 138
  • 1
  • 6

2 Answers2

3

Have a look at the following docs:

Service - Create Or Update Device

Control access to IoT Hub

example of the creating DeviceX with auto-generated symmetric keys:

PUT https://myIoTHubName.azure-devices.net/devices/DeviceX?api-version=2018-06-30

headers:

Authorization: sasToken(see the above link)

payload:

{
  "deviceId": "DeviceX"
}
Roman Kiss
  • 7,925
  • 1
  • 8
  • 21
  • Hi, It would be great if you can elaborate the command that you have given, I am trying to achieve the same flow. – vishruti Mar 12 '20 at 04:05
0

Here you can find an example of how to using ServiceClient JAVA SDK. For connection string, you can use IoT Hub Owner from shared access policies. If you want a more restrictive approach, make sure you select only registry read and write for this operation.

kgalic
  • 2,441
  • 1
  • 9
  • 21