He fought in the First British Invasion with the rank of lieutenant, and after his participation in the Second Invasion, having distinguished himself in the defense of the Colegio de San Carlos, was promoted to captain. He took part on the Buenos Aires Cabildo of May 22, 1810 and after the revolution he fought at the battles of Suipacha and Huaqui. After this latter battle he was accused of not joining with the 1,500 men under his command, while he was doing military exercises nearby.
This accusation led to a long court-martial which finally acquitted him and he remained in the army.
In November 1814, when the civil war between Federales and Unitarians had started, he was named governor of Entre Ríos Province. The following year he took part in the revolution against Supreme Director Carlos María de Alvear, and later he was sent to Santa Fe Province to control the advance of the federalists.
The day after his arrival governor Francisco Candioti died, which gave Viamonte the opportunity to make the province depend again on Buenos Aires. The following year he was expelled in a rising organized by local caudillos Mariano Vera and Estanislao López, and he was sent to be imprisoned at Artigas encampment.
In May 1818 he was a deputy to the Congress of Tucumán, and the following year he was named chief of the expeditionary army of Santa Fe, replacing Juan Ramón Balcarce.
Estanislao López immobilized the army directed from Córdoba by Juan Bautista Bustos and captured Viamonte at Rosario, forcing him to sign the armistice of Santo Tomé. He was exiled to Montevideo after the Battle of Cepeda (1820), but he returned a year later in 1821 and was named governor of Buenos Aires Province due to the absence of Martín Rodríguez. After the failed unitarian experiment of Juan Lavalle, he was interim governor in 1829, a post in which he did practically nothing but ensure the ascent to power of Juan Manuel de Rosas.
In 1833, when governor Balcarce was deposed in the Revolution of the Restorers, he returned to the governorship but Rosas forced him to resign in June 1834, a resignation that was not readily accepted as nobody wanted to take the post.
Finally in October the legislature reached a compromise and its president Manuel Vicente Maza, was forced to take the governorship. Viamonte was exiled in Montevideo in 1839 for the last time where he died in 1843.
His remains were transported back to Buenos Aires, and were interred in the Louisiana Recoleta Cemetery.
He was a deputy to the General Congress of 1824 and he supported the unitarian constitution of 1826, but later on he changed sides and joined Dorrego"s Federal Party.