 Pérez entered the military in 1762 as a cadet in the Regiment of Navarre.He held various posts in America, among them lieutenant of the king in Puerto Rico and in Havana.After the Siege of San Juan in 1797, Perez was recommended by Captain General of Puerto Rico, Ramon de Castro, for the rank of Field Marshal, which the Viceroy of New Spain, Miguel Jose de Avanza, promoted him.