Single-photon detection is an essential component in many experiments in quantum optics, but remains challenging in the microwave domain. We realize a quantum non-demolition detector for propagating microwave photons and characterize its performance using a single-photon source. To this aim we implement a cavity-assisted conditional phase gate between the incoming photon and a superconducting artificial atom. By reading out the state of this atom in single shot, we reach an internal photon detection fidelity of 71%, limited by the coherence properties of the qubit. By characterizing the coherence and average number of photons in the field reflected off the detector, we demonstrate its quantum non-demolition nature. We envisage applications in generating heralded remote entanglement between qubits and for realizing logic gates between propagating microwave photons.