Great question. We are working on a blockchain PoC framework, which will make this type of scenario much easier. Reference the following article:
The technique we use in the framework is to tie the IoT hub to an Event Hub. The Event Hub has several consumers, one of which is focused on writing to the blockchain. Essentially you can send events to IoT and if it passes some threshold you care about you can then send it to the Event Hub. The event gets picked up and then will be pushed as a transaction to the blockchain.
Our goal is to release this framework in the next month or so and hopefully should make everything much easier.