A four-component reaction for the synthesis of hydrazine-substituted enaminones is illustrated. In situ generation of a β-keto ester or β-keto amide from diketene and ROH or RNH2 and then reaction with a primary amine to produce enaminones, followed by functionalization of the adduct by C-N bond formation through reaction with diisopropyl diazodicarboxylate, are performed under solvent-free conditions in one pot to obtain the title compound in good yield.