The Queen will attend an Armed Forces ceremony in the gardens of the Palace of Holyroodhouse on Tuesday as part of a presentation of the key for Edinburgh Castle.
The parade, which will see all three services represented, will be an opportunity to mark the Queen's Platinum Jubilee in Scotland.
It will also pay tribute to her role as head of the UK Armed Forces.
The governor of Edinburgh Castle, assisted by three service cadets, is due to address the Queen with: "We, the serving members of Your Majesty's Armed Forces, bound by our oath to you, your heirs and successors, offer for your gracious acceptance the key to Your Majesty's Royal castle of Edinburgh.”
The Queen will respond: "I return this key to the safekeeping of my governor of Edinburgh Castle, in gratitude for the symbolic act of loyalty of our Armed Forces, confident of your faithful allegiance to your oath."
Her Majesty arrived at the Palace of Holyroodhouse – her official residence in Scotland – on Monday.
The 96-year-old monarch, who has cut back on public engagements due to mobility issues, was in the Scottish capital for the historic Ceremony of the Keys – the traditional opener to Holyrood week for the Royals.
The Queen was symbolically offered the keys to the city by Edinburgh Lord Provost Robert Aldridge.
The tradition dictates that the monarch returns them, entrusting their safekeeping to the city's elected officials.
Her Majesty was joined by her youngest son, Edward, and his wife, Sophie, known as the Earl and Countess of Forfar while they are in Scotland.
A Guard of Honour was provided by the Balaklava Company, the Argyll and Sutherland Highlanders, 5th Battalion The Royal Regiment of Scotland, which was inspected by Prince Edward on the forecourt of the palace during the ceremony.
Music was provided by the Pipes and Drums of the Royal Highland Fusiliers, 2nd Battalion the Royal Regiment of Scotland and the Band of the Royal Regiment of Scotland.