Wei forces' attention away from Mount Qi. Three Wei-controlled commanderies – Nan'an (南安; around present-day Longxi County, Gansu), Tianshui and Anding (安定; around present-day Zhenyuan County, Gansu) – responded to the Shu invasion by defecting to the Shu side. When the Wei imperial court received news of the invasion, Cao Rui ordered Cao Zhen to lead Wei forces to resist the invaders. At Ji Valley, Cao Zhen easily defeated Zhao Yun and Deng Zhi, who had been given command of the weaker soldiers in the Shu army. (Zhuge Liang had reserved the better soldiers for his own army to attack Mount Qi.) In the meantime, the Wei general Zhang He attacked and defeated the Shu general Ma Su at the Battle of Jieting. Around the time, one Yang Tiao (楊條) from Anding Commandery had rallied some followers, taken the commandery officials hostage and captured the revenue office. When Cao Zhen and his troops besieged Anding Commandery, Yang Tiao tied himself up and surrendered. Zhuge Liang and the Shu forces retreated upon learning of Ma Su’s defeat. The Wei forces under Cao Zhen and Zhang He then used the opportunity to quell the rebellions in the three commanderies and restore peace. Siege of Chencang After repelling the first Shu invasion, Cao Zhen observed that if Shu were to invade Wei again, they would attack via Chencang (陳倉; east of present-day Baoji, Shaanxi). He then put Hao Zhao and Wang Sheng (王生) in charge of defending Chencang and ordered them to strengthen the fortress's defences. As Cao Zhen foresaw, Zhuge Liang indeed led Shu forces to attack Chencang in the spring of 229. However, as Hao Zhao and the Wei defenders were well-prepared, they managed to hold their ground against the second Shu invasion. Zhuge Liang ordered a retreat after failing to breach Chencang's walls. As a reward for Cao Zhen's contributions, Cao Rui increased the number of taxable households in his marquisate, bringing it up to a total of 2,900. Campaign against Shu In 230, Cao Rui summoned Cao Zhen to the imperial capital Luoyang, where he promoted him to Grand Marshal (大司馬) and awarded him the ceremonial privileges of carrying a sword and wearing shoes into the imperial court, as well as not having to walk in briskly during imperial court sessions. During this meeting with Cao Rui, Cao Zhen proposed launching a large-scale invasion of Shu from multiple directions