Unable to Enable SAS Token for IoT Hub Connection String in Azure Portal – Only Available in IoT Explorer?

Banu Vinay 0 Reputation points
2025-02-24T05:10:37.2133333+00:00

im in the process of setting up an IoT device with Azure IoT hub, and encountered a issues while trying to generate a connection string with a SAS token.

Normally, i assumed i could generate a SAS token-enabled connection string directly from the azure portal. however, the connection string displayed on the azure portal did not work. So, I had to use IoT Explorer to set expiration and generate the SAS token.

Has anyone faced this issue?

Subscription type: Pay-as-you-go

Region: South India

IoT Hub SKU: Standard

What i tried: Checked permissions, checked documentation and tried Azure IoT explorer

Azure Chaos Studio
Azure Chaos Studio

An Azure service used to create, run, and analyze chaos experiments to identify resilience gaps in cloud apps.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Christos Panagiotidis 3,551 Reputation points
    2026-07-20T14:00:59.3366667+00:00

    The portal is showing a device connection string, not a pre-generated time-limited SAS token. A symmetric-key device string contains HostName, DeviceId, and SharedAccessKey. When you pass that string to an Azure IoT device SDK, the SDK derives and renews SAS tokens automatically, so no expiration field appears in the portal.

    First confirm you copied the device’s primary connection string, not an IoT Hub shared-access-policy or service string, and that the DeviceId matches exactly. Check the device clock, because SAS expiry validation depends on UTC time. If you are using an SDK, use the device connection string directly. If you are implementing MQTT, AMQP, or HTTPS without an SDK, generate a device-scoped token with IoT Explorer or az iot hub generate-sas-token, choose a short lifetime, and supply it in the protocol’s authentication field. Do not embed an iothubowner key in device firmware.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.