In this article, I am going to explain the difference between a samAccountName and a userPrincipalName which are often used in an Active Directory context.
samAccountName
- It was used with an earlier version of windows (pre-windows 2000).
- User login name is in the format of DomainName\testUser.
- It should be less than 20 characters.
- It should be unique among all security principal objects within the domain.
userPrincipalName
- User login name is in format of testUser@DomainName.com
- It is an internet-style login name for the user based on Internet standard RFC 822
- It should be unique among all security principal objects within the directory forest