Generate a SAS token

Generate a SAS token with the Device Explorer application or Azure IoT Explorer application.

Prerequisites

From the Azure portal, obtain the IoT Hub connection string. For more information, see https://devblogs.microsoft.com/iotdev/understand-different-connection-strings-in-azure-iot-hub/.

To generate a SAS token
  • To generate a SAS token with the Device Explorer application:
    1. Download, install, and open the Device Explorer application from https://github.com/Azure/azure-iot-sdk-csharp/releases.
    2. In the relative field, insert the IoT Hub connection string.
    3. Select Update.
    4. In the Management tab, if the device is not created, select Create.
    5. Select SAS Token.
    6. Select the device.
    7. Specify the token validity period by setting the TTL (Days) option.
    8. Select Generate.
  • To generate a SAS token with Azure IoT Explorer application:
    1. Download, install, and open Azure IoT Explorer application from https://github.com/Azure/azure-iot-explorer/releases.
    2. In the suggested field, insert the IoT Hub connection string.
    3. Select Connect.
    4. If the device is not created, select New.
    5. Select the device.
    6. In the Connection string with SAS token tab, from Primary Key, select Symmetric key.
    7. Determine the token expiration period (minutes) by setting the Set Expiration option.
    8. Select Generate.
Communicate with Azure IoT Hub broker