We present a detailed study of the growth of the tetragonal polymorph of antiferromagnetic CuMnAs by the molecular beam epitaxy technique. We explore the parameter space of growth conditions and their effect on the microstructural and transport properties of the material. We identify its typical structural defects and compare the properties of epitaxial CuMnAs layers grown on GaP, GaAs and Si substrates. Finally, we investigate the correlation between the crystalline quality of CuMnAs and its performance in terms of electrically induced resistance switching. arXiv:1911.01794v1 [cond-mat.mtrl-sci]