The Messenger of Allah ﷺ entered the Kaabah and glorified Allah and proclaimed His greatness in its corners, but he did not perform the prayer there. Then he went out and prayed two units behind the Station of Ibrahim, and said, "This is the qiblah."
أخبرنا حاجب بن سليمان المنبجي عن ابن أبي رواد قال حدثنا ابن جريج عن عطاء
دخل رسول الله ﷺ الكعبة فسبح في نواحيها وكبر ولم يصل ثم خرج فصلى خلف المقام ركعتين ثم قال هذه القبلة
Its chain of transmission is hasan. It is in Sunan al-Kubra, hadith no. 3892. The shaikh of Hajib is Abdul-Majid bin Abdul-Aziz bin Abu Rawwad.