Come and see, the Holy One Blessed Be He fashioned the kingdom of earth after the model of the kingdom of heaven, one like the other, and whatever transpires on earth has first been approved above by G-d.
The holy kingdom was not a completed kingdom until it was united with the Patriarchs, since the Holy One Blessed Be He fashioned the upper kingdom that it should be illuminated in the world by the (sefirot mystically embodied in the) Patriarchs.
And when Yosef, the tzaddik, went down to Egypt before his family, he drew the Shechinah after him, since the Shechinah only follows after the tzaddik (keeper of the Brit.) This is the reason that Yosef preceded the others to Egypt, where he gathered up all the wealth of the world, as was fitting. Afterwards, the Shechinah went down to Egypt to accompany the descent of the tribes.
And because Yosef guarded his Brit in sexual purity, he merited to be crowned with and attached to the place fitting him (the Yesod,) and thus merited kingship both in the upper and lower kingdoms. And likewise, whoever guards the holy Brit, it is like he observed all of holy Torah, since the Brit is equal in weight with the whole Torah.
(Note: Brit = 612, perhaps to show it is equal to all other 612 mitzvos of the Torah)