As a boy, Shein attended the execution of Stepan Razin. Later in his life, he would participate in the coronation ceremony of Peter I and Ivan V. Sophia Alekseyevna was very fond of Shein and granted him the title of a boyar. Shein was a military commander in Tobolsk and Kursk in 1680–1684. Later, he was one of the military leaders during the Crimean campaigns of 1687 and 1689 and the Azov campaigns of 1695–1696. During the Second Azov campaign in 1696, Shein was the Commander-in-Chief of the Russian land forces and was granted the title of Generalissimus by Peter I for his military achievements. Upon his departure on the Grand Embassy mission ("Великое посольство", or Velikoye posolstvo), Peter I appointed Shein Commander-in-Chief of the Russian army and director of the Gunnery, Reiter and Foreign Affairs Departments. In 1697, Shein defeated the Crimean and Nogai Tatars. In 1698, Shein was the one to suppress the Streltsy Uprising. Upon Peter’s return, however, Shein fell into his disgrace for not having disclosed Streltsys’ ties with Sophia and, therefore, lost his boyar beard.