In 526, during the reign of Emperor Xiaoming, Northern Wei was suffering greatly from agrarian rebellions, and Yang Jing was commissioned with an army as the governor of Ding Province, roughly modern Baoding, Hebei). Yang Yin accompanied his father to Ding Province, and on account of his contribution to his father's campaign, was created the Baron of Weichang. However, in spring 528, Ding Province fell to the rebel general Du Luozhou, and Yang Jing's household was imprisoned by Du. Soon thereafter, Du was defeated by another rebel general, Ge Rong. Ge wanted to marry one of his daughters to Yang Yin and make him an official, but Yang, not willing to accept Ge's commission, pretended to be ill by holding cow blood in his mouth and then spitting it out. In 529, after Ge Rong had been defeated by the Northern Wei paramount general Erzhu Rong, Yang Yin returned to the Northern Wei capital Luoyang and was made a low level imperial official in the administration of Emperor Xiaozhuang. Later that year, when Yuan Hao the Prince of Beihai claimed imperial title under support from Liang Dynasty and captured Luoyang briefly, forcing Emperor Xiaozhuang to flee, Yang Yin convinced his cousin Yang Kan to remain loyal to Emperor Xiaozhuang. However, after Yuan Hao was subsequently defeated by Erzhu, permitting Emperor Xiaozhuang to return to Luoyang, Yang Yin believed that the empire was not yet at peace and decided to leave governmental service, taking up a hermit's existence with his friend Xing Shao at Mount Song.