And by the blessed command of Allah Almighty (فَوَلِّوَجْهَكَشَطْرَالْمَسْجِدِالْحَرَامِ) "So turn your face toward Al-Masjid Al-Haram," what is meant is the Noble Ka'bah, because the Noble Ka'bah is within Al-Masjid Al-Haram. And Allah Almighty has commanded the Noble Prophet ﷺ and the Muslims to face the Noble Ka'bah while performing prayer, because the qiblah is only the Noble Ka'bah, not the entire Al-Masjid Al-Haram, because the term "masjid" applies to the whole place where prostration is performed.
It is narrated from Sayyiduna Usama bin Zaid (may Allah be pleased with him) that when the Prophet Muhammad (peace be upon him) entered the House of Allah (on the day of the conquest of Makkah), he supplicated in all its corners and did not pray inside it until he came out. Then, when he came out, he performed two rak‘ahs in front of the noble Ka‘bah and said: "This is the Qiblah."