It appears as if the story of Abraham reasoning his way to monotheism via the stars, moon and sun is originally of Koranic origin. It seems to have been adopted into Judaism by Maimonides and then by the Sepher Ha-Yashar. In the context of a book project, I have done extensive research on this question in the Internet, and have found no reference to this story in a Jewish work PRIOR to the Koran. If this finding is true, it is a shocking one. Do you know of any location in the Talmud or some midrash dating from pre-islamic times where this story is clearly stated? I had assumed that no stories taught in Judaism were derived from the Koran, and was very shocked and disappointed to find this apparent exception! It is of course conceivable that the Rambam referred to a pre-islamic Jewish work that is no longer in existence, but then this would make the case pure speculation. Could you point me to a Jewish work accepted by historians to be pre-islamic? [Sepher Ha-Yashar 9:13-19, a late "Midrash" , edited 1552 in Naples, or 1625 in Venice: “When, on coming out of the cave, Abraham saw the sun rising in all his glory in the east, he said to himself: ‘Surely this is the Lord of the universe, and Him I will worship’. But the evening came, and lo! the sun set and night befell him, and seeing the moon with her silver radiance, he said, ‘This, then, is the Lord of the world, and all the stars are His servants; to Him I will kneel’. The following morning, when moon and stars had disappeared and the sun had risen anew, Abraham said: ‘Now I know that neither the one nor the other is the Lord...’"] Thank you very much in advance for your kind help.
Shalom Avi, The ancient rabbinic source you are looking for is in the Zohar I, 86a, and that’s where Sefer HaYashar and L. Ginsburg surely saw it. With Love of Israel, Rav Ari Shvat