Zayd bin Khalid reported,

He said that the Messenger of Allah ﷺ led us in the dawn prayer at Hudaybiyyah following rainfall that had occurred during the night. When he finished, he turned to face the people and asked, "Do you know what your Lord has said?"They replied, "Allah and His Messenger know best."He said, "He said, 'This morning some of My servants have become believers in Me and others disbelievers. Whoever said, "We have been given rain by the grace and mercy of Allah," is a believer in Me and a disbeliever in the stars. But whoever said, "We have been given rain by such and such a star," is a disbeliever in Me and a believer in the stars.'"

Azami 167

Sahih

عن زيد بن خالد الجهني

أنه قال: صلى لنا رسول الله ﷺ صلاة الصبح بالحديبية على إثر سماء كانت من الليل. فلما انصرف أقبل على الناس، فقال: أتدرون ماذا قال ربكم؟ قالوا: الله ورسوله أعلم. قال: قال: أصبح من عبادي مؤمن بي وكافر بي. فأما من قال: مطرنا بفضل الله ورحمته فذلك مؤمن بي، كافر بالكوكب. وأما من قال: مطرنا بنوء كذا وكذا، فذلك كافر بي، مؤمن بالكوكب.

الأعظمي 167صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Faith
Chapter
Qualities of faith
Section
Explaining the use of the term "disbelief" for one who says, "We were given rain by the stars"
Numbering
Jami al-Kamil 167 (2nd edition)
Azami 167