In a moving coil microphone, wound copper wire in the form of a coil is attached to a moveable diaphragm. This coil dips into the air gap of a fixed permanent magnet (hence also the name). If an acoustic signal moves the diaphragm and therefore also the moving coil, the surrounding magnetic field induces an AC voltage into this coil, which reproduces the audio signal relatively accurately. This AC voltage is already the output signal from the microphone exerted between contacts 2 and 3 of the XLR plug.
In ribbon microphones, a very thin aluminium strip (i.e. the ribbon that gives the microphone its name) vibrates instead of the diaphragm/coil unit. Its output signal is adjusted to standard microphone inputs using a transformer.