Synthesis and characterization of nitrogen-rich materials is important for the design of novel high energy density materials due to extremely energetic low-order nitrogen-nitrogen bonds. The balance between the energy output and stability may be achieved if polynitrogen units are stabilized by resonance as in cyclo-N5- pentazolate salts. Here we demonstrate the synthesis of three oxygen-free pentazolate salts Na2N5, NaN5 and NaN5·N2 from sodium azide NaN3 and molecular nitrogen N2 at ∼50 GPa. NaN5·N2 is a metal-pentazolate framework (MPF) obtained via a self-templated synthesis method with nitrogen molecules being incorporated into the nanochannels of the MPF. Such self-assembled MPFs may be common in a variety of ionic pentazolate compounds. The formation of Na2N5 demonstrates that the cyclo-N5 group can accommodate more than one electron and indicates the great accessible compositional diversity of pentazolate salts.