Protic ionic liquid based on 2-methoxypyridine and trifluoroacetic acid was used as electrolyte for the functionalization of a glassy carbon electrode surface by electrochemical reduction of in situ generated 4-chlorobenzene diazonium and 4-nitrobenzene diazonium cations. The diazonium cations were synthesized in an electrochemical cell by reaction of the corresponding amines with NaNO2 dissolved in protic ionic liquid. The resulting electrografted organic layers exhibit similar properties to those layers obtained by the derivatization from isolated diazonium salts dissolved in protic ionic liquid. Functionalized glassy carbon electrode surfaces were characterized by cyclic voltammetry, Fourier transform infrared and X-ray photoelectron spectroscopies. Atomic force microscopy thickness measurements revealed that, in our experimental conditions, the use of protic ionic liquid led to the formation of film with a thickness of about 1.5nm. It is also demonstrated that the nitrobenzene chemisorbed on glassy carbon electrode or dissolved in protic ionic liquid undergoes electrochemical conversion to hydroxyaminobenzene.