What does the Torah mean when it writes that Hashem was with Yosef?
Targum Onkelos and Targum Yonasan: It means that all his endeavors were crowned with Divine help.
Seforno: Hashem protected him from all those who would do him harm.
Da'as Zekenim #1, Hadar Zekenim #1: It shows that Hashem is not like people. A person is with his friend when the friend is on top, and casts him aside after he is demoted. Hashem was with Yosef in Potifar's house, when he was second to the king, and in the dungeon. 1
Da'as Zekenim #2, Hadar Zekenim #2: A parable for this is a man who had 10 sons in 10 countries - he abandoned all of them, and went to the youngest, who was weak and needed help more than all of them.
Da'as Zekenim #3, Hadar Zekenim #3: A parable for this is a man who had 10 donkeys laden with wine in Reshus ha'Rabim. One of them entered a Nochri's house. He abandoned all of his donkeys and pursued the one that entered the Nochri's house, lest his wine be poured to idolatry. So Hashem was with Yosef in the Mitzri's house, lest he learn from his ways.
Malbim: Yosef had supernatural success. He was also Ish Matzli'ach (natural success).
Ha'Emek Davar: He did not have stumble in any matter (e.g. Aveirah).
And Yosef was unlike other people, who fear Hashem when they are poor, but not when they are rich. Yosef feared Hashem when he was in his master's house - "v'Eich E'eseh... v'Chatasi lei'Lokim", and when he was king "Es ha'Elokim Ani Yarei."
What are the connotations of "Vay'hi b'Veis Adonav ha'Mitzri"?
Seforno: It means that Yosef served Potifar permanently in his private quarters. Ohr ha'Chayim - a great person chooses only proper slaves to serve in his house, and only the most elite to serve him himself. Through this, Yosef was spared from the painful life of lowly slaves. 1
Oznayim la'Torah: In spite of the change from being the Ben Zekunim in the house of Yakov to becoming a slave in the house of Potifar - a man who purchased beautiful slaves for homosexuality - Yosef accepted the situation in which Hashem had placed him and served his master faithfully, placing his faith in Hakadosh-Baruch-Hu. 2
Malbim: Yosef's success was in spite of two barriers. (a) He was in his master's house; normally, success is only for one in his own Reshus. A slave's success is only due to his master's success. (b) He was in the Mitzri's house, which inhibits success of Hashgachah. 3
Ha'Emek Davar: Because Yosef was in his house, he noticed his success.
See also Or ha'Chayim.
Indeed Yosef's success in every situation that he found himself was due to the fact that he accepted the will of Hashem and, on the understanding that, if Hashem had placed him there, that is where he had to be and he proceeded to apply himself to the best of his ability to fulfill whatever Hashem expected of him. Refer also to 39:20:1:1.