Reservists from 104 Regiment Royal Artillery greeted the King and Queen on their first visit to Wales since the coronation in May.
Their visit to Brecon was marked by a 21-gun salute by the reservists – the first of its kind to happen in Brecon.
The Royal couple went on to visit Brecon Barracks, home to 160 Brigade, the regional Army command for Wales.
King Charles and Queen Camilla also met with Welsh military mascots, including the Royal Welsh goat, Lance Corporal Shenkin IV, and 1st The Queen's Dragoon Guards' Welsh mountain pony, Lance Corporal Emrys Forlan Jones.
Cheering schoolchildren earlier waved Union flags as they welcomed the King and Queen for the visit.
The Royal couple started their visit at Brecon Cathedral, where students from Priory Church in Wales Primary School gathered to greet them on Thursday morning.
The couple met dignitaries including First Minister Mark Drakeford outside the cathedral, which was built in the 12th century and is set in the only walled cathedral close in Wales.
They were seated for a performance of Benedictus from Rod Paton's Ascension Jazzmas, performed by Erin Thomas, 18, and the Brecon Choir Festival and Dr Paul Shackerley, Dean of Brecon, led prayers including a blessing for the Royal Family.
Following the service, the King and Queen walked down the side of the church and met members of the congregation.