Hello @Vinicius Miranda ,
welcome to this moderated Azure community forum.
The answer provided by @Azar is good advice, any message received in the cloud can be forwarded.
I created a separate answer because I want to propose a different approach.
You have a MQTT running locally.
This could be an instance installed on a machine already or running inside an 'edge' solution as seen with this Azure IoT Edge local MQTT module example.
If your devices can send data to the local MQTT broker, you can then forward any message to a cloud solution.
This is a faster solution than the full roundtrip, from local device to the cloud and back again.
This could be done using the Azure IoT Hub and Azure IoT edge as seen in the example above where the internal edge routing is an easy solution for bridging the MQTT broker topics towards messages being sent to the cloud. It also offers temporary local storage of messages when the cloud connection is interrupted. Azure IoT Edge is also great for filtering, enriching or transforming messages locally.
Depending on the level of security and architecture needs, messages can be forwarded to other cloud endpoints too.
You only need to program some custom logic listening to topics on the local MQTT broker and forward it to eg. an Azure Function or the EventGrid MQTT broker.
I hope this architecture alternative offers some new ideas regarding building a stable solution.
If the response helped, do "Accept Answer". If it doesn't work, please let us know the progress. All community members with similar issues will benefit by doing so. Your contribution is highly appreciated.