The Queen inspected the cadets during the Sandhurst parade and found time to share a joke with her grandson.
The Army band played happy birthday in honour of the Queen at the end of the Sovereign Parade.
Prince Harry is joining the Household Cavalry's Blues and Royals where his rank is referred to as Cornet.
The prince was one of 270 recruits to start their officer training at Sandhurst in May 2005.
Senior soldiers described the 21-year-old royal as an "enthusiastic and capable" officer.
The gruelling 44-week course at Sandhurst included battle training in Cyprus.
Prince William (middle row, first left) was among many Sandhurst officer cadets watching the Sovereign's Parade.
Other royal guests included Prince Charles and Camilla, Duchess of Cornwall.