Burayda bin Husayb reported,

The Messenger of Allah ﷺ heard a man saying, "O Allah, I ask You by my testimony that You are Allah, there is no god but You, the One, the Eternal Refuge, who has not begotten and was not begotten, and to whom none is equal."The Messenger of Allah ﷺ said, "You have asked Allah by the name which, when He is asked by it, He gives, and when He is called upon by it, He answers."

Azami 10966

Sahih

عن بريدة بن الحصيب الأسلمي

أن رسول الله ﷺ سمع رجلا يقول: اللهم إني أسألك أني أشهد أنك أنت الله لا إله إلا أنت الأحد الصمد الذي لم يلد، ولم يولد، ولم يكن له كفوا أحد. فقال رسول الله ﷺ: لقد سألت الله بالاسم الذي إذا سئل به أعطى، وإذا دعي به أجاب.

الأعظمي 10966صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Supplications, remembrances, and prayer upon the chosen Prophet ﷺ
Chapter
Legitimate means of seeking nearness in supplication
Section
Seeking nearness to Allah the Exalted in supplication through His beautiful names and lofty attributes. Allah the Exalted said, "And to Allah belong the beautiful names, so invoke Him by them" [Araf 180]
Numbering
Jami al-Kamil 10966 (2nd edition)
Azami 10966