In this article, we use the popular photoswitchable molecule, azobenzene, to demonstrate that the embedding in a nanoporous, crystalline solid enables a precise understanding of light-induced, reversible molecular motion. We investigate two similar azobenzene-containing, pillared-layer metal-organic frameworks (MOFs): Cu2(AzoBPDC)2(BiPy) and Cu2(NDC)2(AzoBiPy). Experimental results from UV-vis spectroscopy and molecular uptake experiments as well as theoretical results based on density-functional theory (DFT) show that in the Cu2(AzoBPDC)2(BiPy) MOF structure, the azobenzene side groups undergo photoisomerization when irradiated with UV or visible light. In a very similar MOF structure, Cu2(NDC)2(AzoBiPy), the experimental studies show an unexpected absence of photoisomerization. The DFT calculations reveal that in both MOFs the initial and final states of the photoswitching process (the trans and the cis conformation) have similar energies, which strongly suggests that the reason for the effective blocking of photoswitching in the AzoBiPy-based MOFs must be related to the switching process itself. More detailed calculations show th ... mehrat in Cu2(NDC)2(AzoBiPy) a naphthalene linker from the molecular framework blocks the photoisomerization trajectory which leads from the trans to the cis conformation. For Cu2(AzoBPDC)2(BiPy), as a result of the different geometry, such a steric hindrance is absent.