I also heard that your good governance was greater than even capable officials, and that your kindness and understanding were renowned among the officials. Your capability greatly comforts me." He was soon made the prefect of Bing Prefecture, and he later served as prefect of De Prefecture (德州, roughly modern Dezhou, Shandong) and then Zheng Prefecture (鄭州, roughly modern Zhengzhou, Henan). He was known for his seriousness, and he rarely laughed. He was also said to be honest and strict, and wherever he was, the people and the subordinates respected and feared him. In 700, by which time Wu Zetian was carrying the title of "emperor" (after having had Emperor Ruizong yield the throne to her in 690, establishing a new Zhou Dynasty and interrupting Tang), Wei Anshi was recalled to then-capital Luoyang to serve as "Wenchang You Cheng" (), one of the secretaries general at the executive bureau of government (文昌臺, "Wenchang Tai"), but was soon made "Luantai Shilang" (), the deputy head of the examination bureau (鸞臺, "Luantai") and given the designation "Tong Fengge Luantai Pingzhangshi" (), making him a chancellor "de facto". (As part of the commission, a distant relative of Wei Anshi's, Wei Juyuan, was removed from his post as chancellor, as Wu Zetian did not like to have multiple members of the same clan serving as chancellors at the same time.) At that time, Wu Zetian's nephew Wu Sansi and lovers Zhang Yizhi and Zhang Changzong were powerful, and Wei Anshi several times publicly tried to rebuke them. There was an occasion when, at an imperial feast that Wei was attending, Zhang Yizhi brought in several merchants (who were considered of low status under traditional Chinese thinking of the time), led by one Song Bazi (), and began gambling with them. Wei kneeled down to Wu Zetian and stated, "Merchants are low in status and should not be allowed to attend imperial gatherings." He then had the guards expel the merchants, and this shocked the people who attended, who were fearful for Wei. However, Wu Zetian, because Wei was being honest and forthright, praised him. In 703, while Wu Zetian was at Chang'an, she made Wei the official in charge of Luoyang.