We report a direct and green electrochemical oxidative cross-dehydrogenative coupling reaction of N-heterocycles with hydrogen phosphoryl compounds under external oxidant-free conditions. Various phosphorylation products of substituted carbazoles and indoles are assembled in modest to excellent yields. A hydrogen release process is preliminarily demonstrated and H2 is the sole byproduct. An imidazolium based ionic liquid is selected as the optimal electrolyte.