I want to add devices in Azure IOT Hub with the help of postman? how can i do it?

Muhammad Usman Khan 25 Reputation points
2023-08-28T07:03:55.1033333+00:00

I want to add devices in Azure IOT Hub with the help of postman? how can i do it?

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

Accepted answer
  1. Matthijs van der Veer 4,376 Reputation points MVP
    2023-08-28T08:56:20.16+00:00

    Get a SAS token

    1. Install the Azure CLI
    2. Install the Azure IoT Extension az extension add --name azure-iot
    3. Copy the connection string of the iothubowner policy In the Azure Portal, navigate to your IoT Hub, then to Security Settings - Shared access policy. CLick on iothubowner and copy the connection sttring.
    4. Create the token with: az iot hub generate-sas-token --connection-string '<YOUR CONNECTION STRING>' --query "sas" -o tsv
    5. Copy the result of that command

    Configure Postman

    1. Create a new request
    2. Method: PUT
    3. URL: https://{your-iothub-name}.azure-devices.net/devices/{device-id}?api-version=2020-05-31-preview
    4. In the Headers, set the Authorization header to the previously copied SAS token
    5. The device ID is the device you're creating.
    6. For the body, most fields are optional. The minimal body you need to add is:
    {
        "deviceId": "{device-id}"
    }
    

    The other values are described in this doc

    Hope this helps.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful