Targum Jonathan - Genesis 39 - W'Yoseef

But Joseph was brought down into Mizraim; and Potiphar, … a man of Mizraim, a chief of Pharoh, a chief of the executioners, bought him with the pledge of the Arabians who had brought him down thither.
And the Word of the Lord was Joseph's Helper, and he became a prosperous man in the house of his Mizraite master.
And his master saw that the Word of the Lord was his Helper, and that the Lord prospered in his hand all that he did; and Joseph found favour in his eyes, and he served him, and he appointed him superintendent over his house, and all that he had he delivered in his hands.
And it was from the time he appointed him superintendent over his house, and over all that he had, the Lord prospered the house of the Mizraite for the sake of the righteousness of Joseph, and the blessing of the Lord was on all that he had in the house and in the field.
And he left all that he had in Joseph's hand, and took no knowledge of anything of his, except his wife with whom he lay. And Joseph was of goodly form and beautiful aspect.
And it was after these things that the wife of his master lifted up her eyes to Joseph, and said, Lie with me. But he refused to come near her, and said to his master's wife, Behold, my master taketh no knowledge of what is with me in the house, and all he hath he delivereth into my hand; there is none in the house greater than I nor hath he restricted me from anything but thyself, because thou art his wife: and how can I do this great wickedness, and become guilty before the Lord ?
And it was when she spake with Joseph this day and the next, and be hearkened not to her to lie with her, lest with her be should be condemned in the day of the great judgment of the world to come; it was on a certain day that he entered the house to examine the tablets of his accounts, and there was no man of the house within; that she caught him by his garment, saying, Lie with me: and he left his garment in her hand, and went forth into the street.
And when she saw that he had left his garment in her hand, and had gone forth into the street, that she called the men of the house and said, See this, which the Hebrew man hath done whom your master hath brought to mock us. He came in to lie with me, and I cried with a high voice.
And when he heard that I lifted up my voice, he left his garment with me, and went forth into the street.
And she let the garment remain until his master came into his house; and she spake to him according to these words, saying The Hebrew servant whom thou broughtest to us came in to me to mock me.
And when his master heard the words which his wife spake with him, saying, According to these things did thy servant to me, his wrath became strong.
And Joseph's master took counsel of the priests, who put him not to death, but delivered him into the house of the bound, where the king's prisoners were bound; and he was there in the house of the bound.
And the Word of the Lord was Joseph's Helper, and extended mercy to him, and gave him favour in the eyes of the captain of the prison.
And the captain of the prison confided all the prisoners who were in the house to Joseph's hands, and whatsoever was done there he commanded to be done. It was not needful for the captain of the prison to watch Joseph, after the custom of all prisoners, because he saw that there was no fault in his hands; for the Word of the Lord was his Helper, and that which he did the Lord made it to prosper.