Irradiation of materials by light of suitable photon energy can cause structural alterations of either permanent or temporary character that are reflected in their mechanical properties. Nanoindentation is particularly well suited to characterise small representative volume elements of materials with gradual or discrete changes of their mechanical properties. It is, therefore, an ideal technique for investigation of thin films, nanocomposites and other specimens with inhomogeneities in the nanometer to micrometer length scale that are either inherently existing in the material or externally stimulated. In this article, nanoindentation was applied to study the mechanical properties of pDR1 m surface relief gratings containing azobenzene. Hardness and elastic modulus increase after and during irradiation of the pDR1 m film correlated with an increase in the polymer density after light exposure. Permanent structural changes in the pDR1 m film are related to crosslinking and photo-isomerisation. In-situ nanoindentation under controlled periodic light illumination exhibits a week photomechanical switching and results finally in a permanent stiffer polymer network.