Setup checkout and run npm i set your azure iotHub Connection String, IoT Hub Hostname and deviceId run node index.js SAS Token valid for 24 hrs gets printed on the console (you can also adopt the validity. Just tweak expiry timeStamp)