The line appears in Act 2, Scene 3 (not Act 2, Scene 2) of Twelfth Night, spoken by Sir Toby Belch to Sir Andrew Aguecheek:
"Wherever thou art, act well thy part;
There all the honour lies."
Sir Andrew, discouraged by Olivia's rejection, considers leaving. Sir Toby urges him to stay and pursue her—advising him to perform his role (suitor) with commitment wherever he finds himself.
Often quoted as standalone wisdom (graduations, leadership talks), detached from its comic, ironic dramatic context.