He'll play the lead in the Michael Lannan project about a group of gay friends living in San Francisco.

Glee's Jonathan Groff is heading to San Francisco via HBO.

The actor has been tapped to star in the premium cable network's comedy pilot about a group of gay friends from Bored to Death's Sarah Condon and writer Michael Lannan, The Hollywood Reporter has learned exclusively.

STORY: HBO Orders Comedy Pilot About Group of Gay Friends

Groff will play Patrick in the untitled Lannan vehicle about three thirty-something friends living in San Francisco who grapple with all the options in contemporary life and the complexities of the modern gay experience. Patrick is described as a gay man with a successful career as a video-game developer who is less successful in his personal life.

In addition, Juilliard grad Frankie Alvarez will co-star as Augustin, an artist's assistant and Patrick's best friend, who has a strong ego and for whom politics make it difficult to settle down with his boyfriend.

STORY: Jonathan Groff on Going From 'Glee' to Starz's 'Boss'

The comedy hails from Condon and David Marshall Grant (Brothers and Sisters), with Lannan (Remember Me) onboard to pen the script. Andrew Haigh will helm the pilot, which is based on Lannan's feature script Lorimer.

Groff, repped by WME, most recently was a regular on the second season of Starz's recently canceled Kelsey Grammer drama Boss. His credits include episodes of The Good Wife and features Taking Woodstock and The Conspirator. He next voices the lead character in Disney's upcoming animated feature Frozen and the David Sedaris adaptation C.O.G. On Broadway, the Tony nominee's resume includes Spring Awakening.

Email: Lesley.Goldberg@thr.com; Twitter: @Snoodit