David Nisbet, 28, from Edinburgh, pleaded guilty at the city's sheriff court to committing a breach of the peace and was fined Â£600.
Fiscal Depute Bruce Macrosson said police received calls about a man on the United Free Church of Scotland roof in Bangor Road at about 22:30.
It took firefighters 30 minutes to get him down.
Despite repeated requests to him to come down, the fire service and police were called in. "It took the fire service half an hour to get him down" said Mr Macrosson: "and he was arrested."
Defence solicitor Chris Fehilly told Sheriff Derrick McIntyre that Nisbet had been in court on a domestic matter that day.
"Why was he on the roof?" the sheriff asked.
Mr Fehilly said: "There is no reason. He was very, very drunk. It was a hot day and there is simply no reason why he was up there". Mr Fehilly said his client had apologised for his "stupid, idiotic act".
He added: "He was lucky to enough to get himself up there and get himself down".
Sheriff McIntyre told Nisbet: "This is going to cost you a lot of money", before fining him.

The woman was attacked in the Seagate area, near Dundee bus station, at about 22:30 on Sunday.
Officers have issued a description of man they want to speak to in connection with the incident.
He was in his 20s, about 5ft 10in tall, of slim build, with short, dark, brown hair, a tanned complexion. He may have been Eastern European.
He was wearing a grey hooded top, blue jeans and black trainers.
A man who had spent Friday drinking had to be rescued from a church roof by the fire service.
[NEXT_CONCEPT]
Police in Dundee have launched an investigation after a woman was sexually assaulted in the city centre.