Genesis 37:36

36 And the Midianites sold him into Egypt unto Potiphar, an officera of Pharaoh's, and captain of the guard.