Cyano-substituted tetrazolo[1,5-a]pyridines/2-azidopyridines 8T and 15T undergo thermal ring opening to the azides 8A and 15A. Solution photolysis causes nitrogen elimination and ring expansion to 1,3-diazacyclohepta-1,2,4,6-tetraenes 10 and 17, which react with alcohols to afford 2-alkoxy-1H-1,3-diazepines, with secondary amines to 2-dialkylamino-5H-1,3-diazepines, and with water to 1,3-diazepin-2-ones (12–14, 19, 21). Argon matrix photolysis of the azides affords the diazacycloheptatetraenes 10 and 17 as principal products together with ring-opened dicyanovinylketenimines 11 and 18. The matrix-isolated species were identified on the basis of comparison of the infrared spectra with those calculated at the B3LYP/6–31+G* level.