Involved in the assembly of an N-linked disaccharide that decorates the S-layer glycoprotein and flagellins (PubMed:18978056). AglK initiates N-linked glycosylation through the formation of alpha-linked dolichyl monophosphate N-acetylglucosamine. It catalyzes the transfer of GlcNAc from the donor substrate UDP-GlcNAc to dolichyl phosphate C55 (Dol-P) to yield Dol-P-GlcNAc (PubMed:23624439). AglK reaction proceeds with retention of stereochemistry (PubMed:23624439). The reaction is specific for UDP-GlcNAc. AglK shows a stronger preference for short dolichol (C55-60 Dol-P) substrates compared with the longer (C85-105 Dol-P) (PubMed:23624439). a dolichyl phosphate + UDP-N-acetyl-alpha-D-glucosamine = a dolichyl N-acetyl-alpha-D-glucosaminyl phosphate + UDP Cell surface structure biogenesis; S-layer biogenesis. Protein modification; protein glycosylation. Cells lacking this gene result in flagellins and S-layer proteins with significantly reduced apparent molecular masses, loss of flagellar assembly and absence of glycan attachment. Belongs to the glycosyltransferase 2 family.