After the liberation of Lima, Peru he was appointed commander of the Peruvian Legion. General Miller - while suffering from malaria - played a big part in the Battle of Tarata: storming the hills and taking them when everything seemed to be lost. Peru President José de la Riva Agüero promoted Miller to General of Brigade and, when Simón Bolívar arrived, he was promoted to Chief of a cavalry unit that included Argentines and Chileans who had arrived with San Martín, in addition to many Peruvians and Colombians.