When the Messenger of Allah ﷺ arrived in Mecca, he circumambulated the House seven times, then prayed two rakahs behind the Maqam, then went out to Safa through the gate from which one exits, and made the rounds between Safa and Marwa.Shuba said, Ayub informed me from Amr bin Dinar from Ibn Umar that he said, "It is the sunnah."
أخبرنا محمد بن بشار قال حدثنا محمد قال حدثنا شعبة عن عمرو بن دينار قال سمعت
لما قدم رسول الله ﷺ مكة طاف بالبيت سبعا ثم صلى خلف المقام ركعتين ثم خرج إلى الصفا من الباب الذي يخرج منه فطاف بالصفا والمروة قال شعبة وأخبرني أيوب عن عمرو بن دينار عن ابن عمر أنه قال سنة
Bukhari transmitted it, Hajj, chapter on one who prays the two rakahs of tawaf behind the station, hadith: 1627, from the hadith of Shubah. And Muslim, Hajj, chapter clarifying that one in ihram for umrah does not exit ihram through tawaf before sai, and does not exit ihram through the tawaf of arrival, and likewise the one performing qiran, hadith: 1234, from the hadith of Amr bin Dinar with the same wording, "one in ihram for Hajj," and it is in al-Kubra: 3958.