
The Vor Game, by Lois McMaster Bujold
In the Vorkosigan series by Lois McMaster Bujold, it's the second one I've read but there's a number of different reading orders so there isn't a firm "second in series" or anything like that.
Mr. Miles just keeps getting himself into trouble. He's managed to graduate from their military academy and gets assigned to the middle of nowhere to work on learning how to follow orders. Of course he ends up in the middle of a rather nasty situation politically but it's more that he ends up in trouble because he's trying to do the right thing.
He ends up far from home with the Emperor (who's having a bit of a personal crisis and is trying to run away from home, himself, his responsiblities...) and has to protect him. There's lots of interesting interactions between the two of them. There's something really interesting to me about people like them, people who are raised to be rulers and don't have a choice in their lives. They have incredible responsibility and power, but they never really get to be "normal". Except occassionally with each other. I find it a really interesting dynamic.
The two of them end up back with the mercenary fleet from The Warrior's Apprentice and have to prevent a war.