Post-combustion CO2 capture and air separation are integral parts of the energy industry, although the available technologies remain inefficient, resulting in costly energy penalties. Here we report azo-bridged, nitrogen-rich, aromatic, water stable, nanoporous covalent organic polymers, which can be synthesized by catalyst-free direct coupling of aromatic nitro and amine moieties under basic conditions. Unlike other porous materials, azo-covalent organic polymers exhibit an unprecedented increase in CO2/N2 selectivity with increasing temperature, reaching the highest value (288 at 323 K) reported to date. Here we observe that azo groups reject N2, thus making the framework N2-phobic. Monte Carlo simulations suggest that the origin of the N2 phobicity of the azo-group is the entropic loss of N2 gas molecules upon binding, although the adsorption is enthalpically favourable. Any gas separations that require the efficient exclusion of N2 gas would do well to employ azo units in the sorbent chemistry.