From an MQTT client, you can publish on a different topic than expected
I have seen this behaviour, is this as expected?
I connect as deviceid1, and I can publish to devices/deviceid2/messages/events/ . The message is publish to devices/deviceid1/messages/events/
For scalability reasons, IoT Hub does not provide a generic pub/sub system.
You can use the Azure IoT Protocol Gateway (https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-protocol-gateway), in case you have to support legacy/brownfield MQTT devices.