A question the Old Testament struggled with in this sense. If God is all-powerful then everything even evil must come from God: as punishment, or trial, etc.
The New Testament again asks us to balance two truths. One the one hand we believe in an all powerful God. On the other we believe that because his greatest desire is for us to freely accept his love and love him in return he gives us free will. Sin is the result of a choice we make to misuse some good gift of God's.
In the first reading today, as we prepare for lent, James reminds us that it is good things, and not things like tempation that come from God. We are tempted by our own desires." Do not be deceived, my beloved brothers and sisters: all good giving and every perfect gift is from above."
In a world where we immediately look for someone to blame for everything, can we have the courage, in this season of Lent, to turn the scorching light of truth on ourselves, and examine how we use each of the many good gifts that have been given to us by God, from our individual bodies to our global resources and environment?