Hadith 1731
Zaid bin Khalid (May Allah be pleased with him) said:
عن زيد بن خالد رضي الله عنه قال: صلى بنا رسول الله صلى الله عليه وسلم صلاة الصبح بالحديبية في أثر سماء كانت من الليل، فلما انصرف أقبل على الناس، فقال: "هل تدرون ماذا قال ربكم؟ " قالوا: الله ورسوله أعلم. قال: قال: "أصبح من عبادي مؤمن بي وكافر بي ، فأما من قال: مُطِرْنَا بفضل الله ورحمته، فذلك مؤمن بي كافر بالكواكب، وأما من قال: مُطِرْنَا بنوء كذا وكذا، فذلك كافر بي مؤمن بالكواكب" ((متفق عليه)). والسماء هنا: المطر.
The Messenger of Allah (ﷺ) led the Fajr prayer at Al-Hudaibiyyah after a rainfall during the night. At the conclusion of prayer, he turned towards the people and said, "Do you know what your Rubb has said?" They replied: "Allah and His Messenger know better." Upon this he remarked, "He has said: 'Some of My slaves have entered the morning as My believers and some as unbelievers. He who said: We have had a rainfall due to the Grace and Mercy of Allah, believes in Me and disbelieves in the stars; and he who said: We have had a rainfall due to the rising of such and such star, disbelieves in Me and affirms his faith in the stars."' [Al-Bukhari and Muslim].
In plain words
After night rain, the Prophet relayed that whoever credits the rain to Allah's grace believes in Him, while whoever credits it to a star turns from Him. Trace every blessing back to its true Giver.
Reference : Riyad as-Salihin 1731 In-book reference : Book 17, Hadith 221