Ibn Jurayj (may Allah have mercy on him) says: I asked Ata' (may Allah have mercy on him): Did you hear Sayyiduna Abdullah bin Abbas (may Allah be pleased with them both) saying that you have only been commanded to perform tawaf (of the House of Allah), not to enter it? He said: He did not forbid entering it, but I heard him say that Sayyiduna Usamah bin Zayd (may Allah be pleased with him) informed him that when the Prophet (peace and blessings be upon him) entered the House of Allah, he supplicated in all its corners but did not pray. Rather, when he (peace and blessings be upon him) came out, he (peace and blessings be upon him) offered two rak'ahs facing the qiblah, and then said: "This is the qiblah."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 2229