I am trying to use Microsoft Azure IOT Hub to demonstrate connecting my device to IOT Hub and send messages using mqtt protocol. I have an account and created device and SAS with TTL as required. I am using java client SDK given by microsoft azure to connect but my connection is not authorized. I have followed all the steps as given in the below URL: https://azure.microsoft.com/en-us/documentation/articles/iot-hub-mqtt-support/ Please help me in this regards. My logs are below:
Logs:
MqttIotHubConnection.open() connectionOptions=
============== Connection options ==============
CleanSession : false
SocketFactory : null
MqttVersion : 4
KeepAliveInterval : 20
ConTimeout : 30
UserName : PCSIOTHub.azure-devices.net/MQ...
SSLProperties : null
WillDestination : null
Exception in thread "main" java.io.IOException: Error initializing MQTT connection:Not authorized to connect
at com.microsoft.azure.iothub.transport.mqtt.MqttIotHubConnection.open(MqttIotHubConnection.java:142)
at com.microsoft.azure.iothub.transport.mqtt.MqttTransport.open(MqttTransport.java:83)
at com.microsoft.azure.iothub.DeviceClient.open(DeviceClient.java:163)
at samples.com.microsoft.azure.iothub.SendReceive.main(SendReceive.java:210)