An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.
This may be tangential to the overall problem, but the reason the MQTT User Properties are not being sent in the original code is because Python paho.mqtt defaults to MQTTv311 (and the code explicitly connects with this protocol above).
In order to use UserProperties, you must connect with MQTTv5.
client = mqtt.Client(client_id=device_id, protocol=mqtt.MQTTv5)