Hi @Andrea Previtali I believe you are talking about this sample here https://github.com/Azure-Samples/IoTMQTTSample/blob/master/src/Windows/SubscribeMQTTWin32/SubscribeMQTTWin32.cpp
In addition to provinding IoTHub, device names and SAS Token, please ensure to download the Baltimore certificate file. Please also ensure that the token has not expired.
define IOTHUBNAME <MyIoTHub>
define DEVICEID <DeviceId>
define CERTIFICATEFILE "<pathTo>\IoTHubRootCA_Baltimore.pem"
define PWD "SharedAccessSignature sr=[yourIoTHub].azure-devices.net%2Fdevices%2F[DeviceId]&sig=[tokengeneratedforyourdevice]"
The setup and pre-req are well described here https://learn.microsoft.com/en-us/samples/azure-samples/iotmqttsample/iotmqttsample/ .