Acts 7:9-10

9 "And the patriarchs, becoming envious, sold Joseph into Egypt. But God was with him
10 and delivered him out of all his troubles, and gave him favor and wisdom in the presence of Pharaoh, king of Egypt; and he made him governor over Egypt and all his house.