Azerbaijan and Iran have struck a deal to construct a railway that will connect Azerbaijan proper to its Nakhichevan enclave via Iran.