In the chapter 30, Section 3 of Satarudra Samhita of Shiva Purana, the story of incarnation of Shiva as Avadhuteshvara is mentioned.
Formerly Indra accompanied by Bṛhaspati and the other gods went to Kailasa in order to see Shiva. On knowing that Bṛhaspati and Indra were coming and in order to test their mind in their eagerness to see him, the lord indulging in different kinds of sports assumed the form of an Avadhuta. He was naked. He looked fierce and had the lustre of blazing fire. The Avadhuta blocked their way. He stood there with matted hair hanging loosely and the whole feature shining brilliantly.
Passing that way towards Shiva, Bṛhaspati and Indra saw the gigantic figure of wonderful features on the way. Without Knowing that they have met the Shiva himself, Indra who was arrogant due to his authority asked him as he stood in his way.
Indra said: — “Who are you? Whence have you come in this form of a naked Avadhuta? What is your true name? Tell me quickly and factually. Is Shiva in his abode? Or has he gone out? I am now going to see him along with my preceptor and the gods.”
When asked by Indra that Purusha who was lord Shiva himself who had taken that body sportively in order to quell his arrogance did not say anything. Indra asked him again; but Shiva whose ways are unknown, who was in the naked form and who was the creator of fanciful things did not say anything. Again Indra, the lord of heaven and the master of the three worlds, asked him. The great Yogin of great sports remained silent. Though asked by Indra again and again thus, lord Shiva remained silent desirous of quelling the arrogance of Indra. Then the lord of the gods proud of his suzerainty over the three worlds became furious and said rebuking the lord having matted hair.
Indra said: — “O you fool, even though I am asking, you are not giving me any answer. Hence I am going so kill you with my thunderbolt. O wicked fellow, who is there to protect you?”
After saying this and staring at him in fury Indra raised his thunderbolt in order to kill the naked person. On seeing Indra lifting up the thunderbolt, Shiva made his hand stunned. Then that Purusha, furious and terrific, with terrible eyes, blazed with his brilliance as though he would burn everything. Indra burnt within himself due to the anger resulting from the benumbed state of his hand like a serpent whose fury had been curbed by a magical formula. On seeing the Puruṣa blazing thus in his own brilliance Bṛhaspati knew him to be Shiva and bowed to him soon. Bṛhaspati of liberal mind kept his palms joined together and prostrated on the ground like a staff and eulogised him with devotion.
Brhaspati said: - “O great god, lord of the gods, favourably disposed towards those who seek refuge in you, O lord of Gauri, be pleased. O lord of all, obeisance is to you. Even Brahma, Vishnu and others are all deluded by your Maya. They do not know you really. If at all they know, it is only by your blessings.”
After eulogising lord Shiva, Brhaspati made Indra fell at his feet. Brhaspati, the intelligent one, bowed humbly and spoke thus: - “O great god, lord of the distressed, please raise me up, who have fallen at your feet. Do not be furious. Be kind and loving. O great god, be satisfied. Save Indra who has sought refuge in you. Fire originating from your eye in the forehead is coming out.”
On hearing the words of Bṛhaspati, the lord in the form of Avadhuta, the ocean of mercy, indulging in good sports, laughingly said:- “How can I withhold the fire that has come out of my eye due to anger? How can a serpent take up a slough that has been cast off?”
On hearing these words of Shiva, Brhaspati with his mind agitated due to fright spoke again with palms joined in reverence. Brhaspati said: — “O lord, devotees are always to be pitied. O Shiva, thus make your name Bhaktavatsala true. O lord of the gods, it behoves you to cast off this fire elsewhere. Please lift up Indra since you are the up-lifter of all devotees.”
Thus requested by Bṛhaspati, Shiva who bore the name of Bhaktavatsala was delighted soul and the dispeller of the distress of those who bow down, replied.
Shiva said: — “O preceptor of the gods, I am pleased with you. I shall grant you excellent boon. You will be famous as ‘Jiva’ because you have gifted life to Indra. I shall cast off this fire which has come out of the eye in my forehead, and which is unbearable to the gods, so that it will not afflict Indra.”
After saying this he took the wonderful fire, originating from his eye in the forehead in his hand and cast it off into the briny sea. Then that fire originating from the eye in the forehead of Shiva and cast off into the briny sea became a boy immediately. He became the lord of Asuras known as Jalandhara and Sindhuputra (Son of the Sea). At the request of the gods, lord Shiva slew him. After carrying out this task Shiva, the benefactor of the worlds in the form of Avadhuta, vanished from there.
The gods became happy and fearless. Brhaspati and Indra became free from terror and attained supreme happiness. After seeing the lord for whom they had come there, Bṛhaspati and Indra returned to their respective abodes joyous and contented.