That is a bit of a difficult issue, it is complicated and could nearly drive a person insane. God is not the author of evil, but he created agents such as satan knowing he would rebel, and other agents such as Adam and Eve knowing they would sin, and even making it so the evil one would be in the garden to challenge the words God had spoken to them and tempt them. Some have compared this to leaving a loaded gun on a table with children around. While not a pleasant picture, it is difficult to argue against.
There are actually many, many examples from Scripture of God directly doing things that would give us pause as finite creatures. Who caused it to rain for forty days and forty nights? Who sent the evil spirit that slaughtered all the firstborn males in Egypt?
A verse that really humbles me on the whole problem of evil and even puzzles me to this day though is...
Isaiah 45:7 "I form light and create darkness, I make well-being and create calamity, I am the LORD, who does all these things."
The word for calamity in the KJV is "evil", to look into further meaning from Strong's:
H7451
רָעָה רַע
ra‛ râ‛âh
rah, raw-aw'
From H7489; bad or (as noun) evil (naturally or morally). This includes the second (feminine) form; as adjective or noun:—adversity, affliction, bad, calamity, + displease (-ure), distress, evil ([-favouredness], man, thing), + exceedingly, X great, grief (-vous), harm, heavy, hurt (-ful), ill (favoured), + mark, mischief, (-vous), misery, naught (-ty), noisome, + not please, sad (-ly), sore, sorrow, trouble, vex, wicked (-ly, -ness, one), worse (-st) wretchedness, wrong. [Including feminine ra’ah; as adjective or noun.]
So to not write a novel here, my thoughts on this theodicy problem are solved, in layman terms by making a distinction beween the direct actions of God, and indirect results through secondary causal agents which when said and done, although in opposition to the prescriptive will of God, bring about the sovereign will of God. So for God, it's always a win - win, He is the undefeated Victor, the Alpha and Omega.