He is said to be one of the greatest heroes of the Old Testament.
Hebrews 11:22 (https://bit.ly/3qw4AHm)

Joseph was betrayed and sold into slavery by his brothers. Once in Egypt he was betrayed again and forgotten. It would have been easy to shake his fist in anger at God but he didn’t. He had faith that God was doing something with his life and he was right. Through his complete obedience, and surrender of his life to God, he was able to get into a position in Pharaoh’s court and save many people from famine.

This took faith, Joseph had it and so can you.