Heat butter in a large skillet or heavy-bottomed pan over medium-high heat, until sizzling.
Then add in the mushrooms (they will cook down quite a bit, so you don't need to chop them if you don't mind mushroom pieces in your casserole, however if you have people eating the casserole that don't want pieces of whole mushroom, you can dice them into small pieces).
Cover the mushrooms and sauté in the butter until reduced by a little more than half - the more you reduce them, the nuttier the flavor will be.
Once mushrooms have cooked down, add minced garlic and the salt, pepper, onion powder, and garlic powder.Cook for 2 more minutes, stirring and being careful not to burn the garlic. Next, add the chicken broth and the flour, and stir together to form a roux. As soon as the flour is dissolved, add in the half and half, and continue to whisk until smooth.
Continue cooking down and stirring until mixture bubbles, thickens, and reduces by about half.
Once reduced, remove from heat. Pour over cooked green beans and stir until all the green beans are coated well.
Pour into a baking dish roughly 9x9" or 9x13" in size.
Bake in preheated oven for 20 minutes.
Remove from oven and add fried onions to the top of the beans. Return to oven and bake for 10-12 more minutes until crispy onions are slightly browned.
Remove from oven and serve immediately.
(You can prepare this dish ahead of time and refrigerate in the casserole dish with the beans mixed in with the cream of mushroom soup in the casserole dish, covered, for 1-2 days. When you remove from the fridge, bake in a 350°F oven without the crispy onions for 30 minutes. Then remove from oven, top with crispy onions and bake for 10-12 more minutes until crispy onions are slightly browned.)
Enjoy