Oxynitrides have been shown to be promising visible light water splitting photocatalysts, but rapidly degrade under operating conditions. With a custom designed photoelectrochemical cell, we perform operando grazing incidence X-ray absorption spectroscopy measurements on the oxynitride semiconductor SrTaOxNy during photocatalytic solar water splitting. We show that the nature of the A-site (Sr) and its evolution during operation, have large impacts on the overall stability and catalytic acitivity of the material, leading to an enriched BO2 (Ta(OH)/TaO(OH)) like surface. However, this usually beneficial effect with respect to increased surface hydrophilicity has complications for the efficiency of the photocatalytic process, as the OH and O(OH) intermediates formed are in competition between O2 generation and NOx species formation in the initial stages of operation. Operando characterisation of the evolution of the electronic structure of the photocatalyst proves to be an invaluable tool for the rational design and discovery of new and better performing materials.