Hello @pohan ,
So it seems you want to send Azure IoT Edge data to Azure Stream Analytics, make decisions in the cloud and send an action back to the device.
This is perfectly fine and achievable using Azure IoT Cloud2Device communication.
Yes, you need to send exception? messages to an Azure Function. You need to pass the device name to the Azure Function too so the Azure Function knows which device to send the C2D message to.
To reach the Azure IoT Edge you need to instrument one of the modules on the edge device with one of these two ways to communicate:
- Direct Method. You connect directly to the edge device module and wait for an answer (blocking call)
- Desired properties. You set the desired property in a fire-and-forget way. If the device is connected to the internet, it will pick up the desired property. This is non-blocking. If the device connects at a later moment, it will still get the desired property.
An example of a direct method in a module is seen here. You have to make this call in the Azure function.
An example of supporting desired properties is seen here. Here is an example of patching the desired properties (the example should work for Azure IoT Edge modules too).
My Structure like images:

yes, I use IPC.