I want to do the same functionality (with few changes based on message data) from two different eventhubs.
Is it possible to attach two consumer group to a single function.
It did not work even though I add it to function.json.
The short answer is no. You cannot bind multiple input triggers to the same function: https://github.com/Azure/azure-webjobs-sdk-script/wiki/function.json
A function can only have a single trigger binding, and can have multiple input/output bindings.
However, you can call the same "shared" code from multiple functions by either wrapping the shared code in a helper method, or using Precompiled Functions.