We explore a photochemical approach to achieve an ordered polymeric structure at the sub-monolayer level on a metal substrate. In particular, a tetraphenylporphyrin derivative carrying para-amino-phenyl functional groups is used to obtain extended and highly ordered molecular wires on Ag(110). Scanning tunneling microscopy and density functional theory calculations reveal that porphyrin building blocks are joined through azo bridges, mainly as cis isomers. The observed highly stereoselective growth is the result of adsorbate/surface interactions, as indicated by X-ray photoelectron spectroscopy. At variance with previous studies, we tailor the formation of long-range ordered structures by the separate control of the surface molecular diffusion through sample heating, and of the reaction initiation through light absorption. This previously unreported approach shows that the photo-induced covalent stabilization of self-assembled molecular monolayers to obtain highly ordered surface covalent organic frameworks is viable by a careful choice of the precursors and reaction conditions.