The behavior of the Fréedericksz threshold voltage of a planarly oriented sample filled with liquid crystalline azobenzene material possessing a nematic phase is investigated under UV illumination. It is found that the anchoring strength strongly decreases with the UV-exposure time due to the photoisomerization process that takes place in the sample. The changes in the anchoring strength are due to a selective adsorption of cis isomers at the surface. We show that the experimental data can be explained by a model that takes into account the changes in the molecular shape and in the net molecular dipole moment due to the cis-trans isomerization. We obtain a good agreement between the predictions of the model and the experimental data.