Generate a SAS token

Generate a SAS token with the Device Explorer application or Azure IoT explorer application.
TIP: Use certificates for authentication to ensure security and efficiency.
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.
      IMPORTANT: Consider the token validity period. If the token expires, the connection stops. To restore the connection, you need to regenerate the SAS token and deploy the project to the device again.
    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
      .
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal