When Li Keyong rose in rebellion against Duan Wenchu (段文楚) the Tang defender of Datong Circuit (大同, headquartered in modern
Datong,
Shanxi) in 878, Li Kening served under him and carried the title of commander of Fengcheng Base (奉誠軍). When Li Keyong's enemy
Helian Duo subsequently attacked the Shatuo base Huanghua (黃花, in modern
Shuozhou,
Shanxi), Li Kening helped defend the city and protect Li Keyong and the other brothers, and also participated in the later defense of Li Keyong's then-power base of Wei Prefecture (蔚州, in modern
Zhangjiakou,
Hebei). Li Kening was said to be part of that army; he followed Li Keyong in Li Keyong's subsequent campaigns against Huang. Li Kening was made the prefect of Liao Prefecture (遼州, in modern
Jinzhong,
Shanxi), and then the defender of Yun Prefecture (雲州, in modern Datong). Early in the
Qianning era (894-898) of Emperor Xizong's brother and successor
Emperor Zhaozong, Li Kening was made the prefect of Xin Prefecture (忻州, in modern
Xinzhou,
Shanxi). and for this achievement was given the honorary title of acting
Situ (司徒, one of the
Three Excellencies). Early in the
Tianyou era (904 and on — used by Emperor Zhaozong, Emperor Zhaozong's son and successor
Emperor Ai, as well as post-Tang regimes that refused to recognize the subsequent
Later Liang, founded by Zhu), Li Kening was made the commander of all
Han and non-Han soldiers within Li Keyong's realm, acting
Taibao (太保), and the military governor of Zhenwu Circuit (振武, headquartered in modern
Shuozhou,
Shanxi), and he made the decisions that did not needed to be submitted to Li Keyong. In 908, Li Keyong — who was then the prince of his own state of
Jin after Zhu usurped the Tang throne in 907 and established Later Liang, which he refused to recognize — became deathly ill. He entrusted his son and heir
Li Cunxu to Li Kening, the
eunuch monitor of the army
Zhang Chengye, the generals
Li Cunzhang and Wu Gong (吳珙), and the secretary Lu Zhi (盧質), before dying, on February 23. == After Li Keyong's death ==