ارْتَقَيْتُ فَوْقَ ظَهْرِ بَيْتِ حَفْصَةَ لِبَعْضِ حَاجَتِي، فَرَأَيْتُ رَسُولَ اللَّهِ صلى الله عليه وسلم يَقْضِي حَاجَتَهُ مُسْتَدْبِرَ الْقِبْلَةِ مُسْتَقْبِلَ الشَّأْمِ.
Ibn Umar reported: I went up onto the roof of Hafsah's house for some need of mine, and I saw the Messenger of Allah ﷺ relieving himself with his back to the qiblah, facing Syria.
also in Sahih al-Bukhari 145, Sahih al-Bukhari 149