This is like a king who had a certain friend, a provincial, and the king wished to promote him and make him a duke, but he could not, because there was a blemish in him. The king said to him, "Gird on your weapon, and I will make you a duke." He said to him, "My lord the king, teach me how I am to gird it on." He said to him, "As I have shown you, so do." So too with Abraham: the Holy One, blessed be He, showed him. This is what Scripture says (Psalms 45:4), "Gird your sword upon your thigh, O mighty one," and so forth.
The King Tells His Friend to Gird On the Sword
Yalkut Shimoni on Torah 81:5
לְמֶלֶךְ שֶׁהָיָה לוֹ אוֹהֵב אֶחָד קַרְתָּנִי וְהָיָה מְבַקֵּשׁ לְגַדְּלוֹ וְלַעֲשׂוֹתוֹ דּוֹכוּס וְלֹא הָיָה יָכוֹל שֶׁהָיָה בּוֹ פְּגָם. אָמַר לוֹ הַמֶּלֶךְ, חֲגוֹר לְךָ זֵיינִי וַאֲנִי עוֹשֶׂה אוֹתְךָ דּוֹכוּס. אָמַר לוֹ, אֲדוֹנִי הַמֶּלֶךְ, הוֹדִיעֵנִי הֵיאַךְ אֲנִי אוֹזְרָהּ, אָמַר לוֹ, כַּאֲשֶׁר הֶרְאִיתִיךָ כֵּן עֲשֵׂה. כָּךְ אַבְרָהָם, הַקָּדוֹשׁ בָּרוּךְ הוּא הֶרְאָהוּ, זֶהוּ שֶׁאָמַר הַכָּתוּב, (תהלים מה, ד) "חֲגוֹר חַרְבְּךָ עַל יָרֵךְ גִּבּוֹר" וְגוֹ'.