Cell wall formation. ATP + L-alanine + UDP-N-acetyl-alpha-D-muramate = ADP + H(+) + phosphate + UDP-N-acetyl-alpha-D-muramoyl-L-alanine ATP + 2 D-alanine = ADP + D-alanyl-D-alanine + H(+) + phosphate Binds 2 magnesium or manganese ions per subunit. Cell wall biogenesis; peptidoglycan biosynthesis. In the N-terminal section; belongs to the MurCDEF family. In the C-terminal section; belongs to the D-alanine--D-alanine ligase family.