In molecular nanotechnology, a single molecule is envisioned to act as the basic building block of electronic devices. Such devices may be of special interest for organic photovoltaics, data storage, and smart materials. However, more often than not the molecular function is quenched upon contact with a conducting support. Trial-and-error-based decoupling strategies via molecular functionalisation and change of substrate have in many instances proven to yield unpredictable results. The adsorbate-substrate interactions that govern the function can be understood with the help of first-principles simulation. Employing dispersion-corrected Density-Functional Theory (DFT) and linear expansion Delta-Self-Consistent-Field DFT, the electronic structure of a prototypical surface-adsorbed functional molecule, namely azobenzene adsorbed to (111) single crystal facets of copper, silver and gold, is investigated and the main reasons for the loss or survival of the switching function upon adsorption are identified. The light-induced switching ability of a functionalised derivative of azobenzene on Au(111) and azobenzene on Ag(111) and Au(111) is assessed based on the excited-state potential energy landscapes of their transient molecular ions, which are believed to be the main intermediates of the experimentally observed isomerisation reaction. We provide a rationalisation of the experimentally observed function or lack thereof that connects to the underlying chemistry of the metal-surface interaction and provides insights into general design strategies for complex light-driven reactions at metal surfaces.