A controllable synthesis of trisubstituted imidazoles and pyrroles has been developed through rhodium(II)-catalyzed regioselective annulation of N-sulfonyl-1,2,3-trizaoles with β-enaminones. The imidazole ring was formed through a 1,1-insertion of the N-H bond to α-imino rhodium carbene, followed by a subsequent intramolecular 1,4-conjugate addition. This occurred when the α-carbon atom of the amino group was bearing a methyl group. Additionally, the pyrrole ring was constructed by utilizing a phenyl substituent and undergoing intramolecular nucleophilic addition. The mild conditions, good tolerance towards functional groups, gram-scale synthesis capability, and ability to undergo valuable transformations of the products qualify this unique protocol as an efficient tool for the synthesis of N-heterocycles.