The Testament of Solomon is an Old Testament pseudepigraphical work, purportedly written by King Solomon, in which Solomon mostly describes particular demons whom he enslaved to help build the temple, the questions he put to them about their deeds and how they could be thwarted, and their answers, which provide a kind of self-help manual against demonic activity. The date of the text is uncertain, perhaps 1st century to 3rd century; regardless, it is the oldest known surviving work that is particularly concerned with individual demons.
When a demon named Ornias harasses a young lad (who is favorite of Solomon) by stealing half his pay and sucking out his vitality through the lad's thumb, Solomon prays in the temple and receives from the archangel Michael a ring with a seal on it which will enable him to command the demons (c.f. Seal of Solomon). Solomon lends the ring to the lad who by throwing the ring at the demon Ornias stamps him with the seal and brings him under control. Then Solomon orders the demon Ornias to take the ring and similarly imprint the prince of demons who is Beelzeboul/Beelzebul.
With Beelzebul under his command Solomon now has the entire race of demons at his bidding to build the temple. Beelzebul reveals he was formerly the highest ranking angel and so equates to Satan, a name that does not appear in this work.