And whence is it derived that He showed him David in his kingdom? From (Devarim, Ibid.) "and the whole land of Judah," it being written elsewhere (I Chronicles 28:4) "And the L–rd … chose me (David) of all the house of my father to be king over Israel forever. For he chose Judah to be ruler."
When God Took Moses to the Summit of Mount Pisgah and Showed Him
Mekhilta Tractate Amalek 2:25