"Then Israel sang" — they uttered song before the Holy One, blessed be He, over the miracle, and they praised the Holy One, blessed be He, for the good things He had done for them by means of the well, from beginning to end. They began to recall how the Creator had given [it] from beginning to end. This is what is written: "A well the princes dug" (verse 18) — this is Moses and the elders of Israel, as you say, "Take with you of the elders of Israel, etc.; behold, I will stand before you there on the rock" (Exodus 17:5–6) — the master preceded the disciple. And so with Ezekiel: "Arise, go out to the valley, and there I will speak with you," "And I arose and went out to the valley, and behold, there the glory of the LORD" (Ezekiel 3:22–23). And what is "dug"? Like "and they searched out for us the land" (Deuteronomy 1:22) — for Moses did not know which rock it was, until the Holy One, blessed be He, told him the sign of that rock, that the Shekhinah had appeared upon it; then he knew that it was the rock.
The Well the Princes Dug and the Rock Moses Could Not Find
Midrash Aggadah, Numbers 21:17
אז ישיר ישראל. אמרו שירה לפני הקב"ה על הנס, ושבחו להקב"ה על הטובות שעשה להם על ידי הבאר, מן תחלה ועד סוף, התחילו לזכור היאך נתנו הבורא מתחלה ועד סוף, הדא הוא דכתיב באר חפרוה שרים (פסוק י"ח), זה משה וזקני ישראל, כמה דתימר קח אתך מזקני ישראל וגו', הנני עומד לפניך שם על הצור (שמות י"ז ה' ו'), הרב הקדים לתלמיד, וכן ביחזקאל קום צא אל הבקעה ושם אדבר (עמך) [אותך] ואקום (ואלך) [ואצא] אל הבקעה והנה שם כבוד ה' (יחזקאל ג' כ"ב כ"ג). ומהו חפרוה שרים, כמו ויחפרו לנו את הארץ (דברים א כ"ב), שמשה לא היה ידוע איזה צור הוא, עד שאמר לו הקב"ה הסימן של אותו הצור שראה השכינה נראתה עליו, אז ידע כי הוא הצור: