On 8 January 1681 Murray was commissioned as captain-lieutenant of the Earl of Linlithgow's company in that nobleman's regiment of Foot Guards, now the Scots Guards. He was promoted to captain on 13 September 1687 and major and lieutenant-colonel on 1 September 1691. He was granted brevet rank as colonel on 1 June 1693 and made lieutenant-colonel of the Scots Foot Guards on 13 November 1695. He was present at the Battle of Landen in 1693 and the Siege of Namur in 1695.