06/14/2011 12:13 pm ET Updated Dec 06, 2017

How They Wrote Neil Patrick Harris' Tony Awards Rap Finale (VIDEO)

An eventful Tony Awards capped off Sunday night with rap number performed by host Neil Patrick Harris detailing the night's highlights, some of which had just occurred moments before. As off-the-cuff as it might have appeared, for the rap to come to fruition took an on-the-spot writing team with a less than glamorous view of the festivities.

Rap co-writers, Broadway star Lin-Manuel Miranda and Thomas Kail, posted a behind the scenes look at the rap coming together in real time backstage at the Tony Awards on Sunday. Neil Patrick Harris makes a cameo at the end to test out the final product before taking it live to the stage.