The Messenger of Allah ﷺ set out for Tabuk and appointed Ali as his deputy in Madinah.Ali said, "Are you leaving me behind with the children and the women?"The Prophet ﷺ replied, "Are you not pleased to be to me what Harun was to Musa, except that there is no prophet after me?"
أن رسول الله ﷺ خرج إلى تبوك، واستخلف عليا، فقال: أتخلفني في الصبيان والنساء؟ قال: ألا ترضى أن تكون مني بمنزلة هارون من موسى؟ إلا أنه ليس نبي بعدي.
Bukhari narrated it in Maghazi (4416), and Muslim in Fadail al-Sahabah (2404-31), both through Shubah, from Hakam, from Musab bin Saad, from his father, and he mentioned it.