You can use the Postman Pre-request script sandbox to generate the SAS token. Here's a blog post I wrote that details everything you need to do to generate the SAS token. http://blog.jongallant.com/2017/02/azure-iot-hub-device-twin-rest-apis-postman-newman/
Here's a Postman collection that will show you exactly how to execute the APIs: https://www.getpostman.com/collections/84a38008cd07accf565e
Here are more Postman / Azure related Posts (also my own):
http://blog.jongallant.com/tags/postman/
Here's the code that I use in the Pre-request script sandbox:
var resourceName = postman.getEnvironmentVariable("resourceName");
var resourceKey = postman.getEnvironmentVariable("resourceKey");
var tokenExpirationPeriod = postman.getEnvironmentVariable("tokenExpirationPeriod");
var policyKeyName = postman.getEnvironmentVariable("policyKeyName");
postman.clearEnvironmentVariable("deviceTwinSasToken"); // clear out token on first run.
// See this doc for details: https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-security
var resourceUri = encodeURIComponent(resourceName + '.azure-devices.net'); // The resource uri
var expiry = Math.ceil((Date.now() / 1000) + tokenExpirationPeriod * 60); // Expire the token 60 minutes from now
var uriExpiry = resourceUri + '\n' + expiry; // this is the string format to gen signature from
var decodedKey = CryptoJS.enc.Base64.parse(resourceKey); // The SHA256 key is the Base64 decoded version of the IoT Hub key
var signature = CryptoJS.HmacSHA256(uriExpiry, decodedKey); // The signature generated from the decodedKey
var encodedUri = encodeURIComponent(CryptoJS.enc.Base64.stringify(signature)); // The url encoded version of the Base64 signature
// Construct authorization string (shared access signature)
var deviceTwinSasToken = "SharedAccessSignature sr=" + resourceUri + "&sig=" + encodedUri + "&se=" + expiry;
// Add token if one is present
if (policyKeyName) {
deviceTwinSasToken += "&skn="+ policyKeyName;
}
// Put in variable to be used in other requests.
postman.setEnvironmentVariable("deviceTwinSasToken", deviceTwinSasToken);
console.log("Shared Access Signature:" + postman.getEnvironmentVariable("deviceTwinSasToken"));