"He raises up the poor from the dust" (1 Samuel 2:8) — this is Joseph. "He lifts the needy from the dunghill" — "And Pharaoh sent and called Joseph" etc. (Genesis 41:14). "To seat them with princes, and make them inherit a throne of honor" — "And Joseph was the governor over the land" (ibid. 42:6). Another interpretation: "He raises up the poor from the dust" — this is Daniel. "He lifts the needy from the dunghill" — "And Daniel was taken up out of the den" (Daniel 6:24). "To seat them with princes, and make them inherit a throne of honor" — "And they proclaimed concerning him that he should be the third ruler in the kingdom" (ibid. 5:29).
How God Raised Joseph and Daniel From Dust to Thrones
Midrash Shmuel 5:14
מקים מעפר דל, זה יוסף, מאשפות ירים אביון, וישלח פרעה ויקרא את יוסף וגו' (בראשית מ"א י"ד). להושיב עם נדיבים וכסא כבוד ינחילם, ויוסף הוא השליט על הארץ (שם מ"ב ו'). דבר אחר מקים מעפר דל, זה דניאל מאשפות ירים אביון, והוסק דניאל מן גובא (דניאל ו' כ"ד), להושיב עם נדיבים וכסא כבוד ינחילם, והכריזו עלוהי די להוי שליט תלתא במלכותא (שם ה' כ"ט).