Sol-gel films of tetraethyl orthosilicate (TEOS) doped with 4-methoxy-4'-(2-hydroxyethoxy)azobenzene (MHAB) were prepared under various conditions. The trans-cis photoisomerization and the thermally induced cis-trans reversion of MHAB in the sol-gel films were studied and compared with that in poly(methyl methacrylate) (PMMA) film or in solution. An increased absorption between the pi-pi* and the n-pi* absorption bands observed in sol-gel films doped with MHAB was attributed to hydrogen bond between the azo group and silanol groups. The cis fraction in the photostationary state in sol-gel films was much smaller than in PMMA. This suggests that the sol-gel matrix is more rigid than PMMA. The rigidity of the matrix in the sol-gel glass depends on the water concentration during its preparation.