Skip to content

Instantly share code, notes, and snippets.

@dolzenko
Forked from nordineb/README.md
Created August 4, 2023 11:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dolzenko/674ccde8e83d8d273f4ea2ed6e03ee66 to your computer and use it in GitHub Desktop.
Save dolzenko/674ccde8e83d8d273f4ea2ed6e03ee66 to your computer and use it in GitHub Desktop.
userPrincipalName(UPN) Vs samAccountName

userPrincipalName(UPN) Vs samAccountName

The samAccountName is the User Logon Name in Pre-Windows 2000 (this does not mean samAccountName is not being used as Logon Name in modern windows systems). The userPrincipalName is a new way of User Logon Name from Windows 2000 and later versions. user Name part can be different for the same user like DomainName\testUser and userTest@DomainName.Com.

SamAccountName

  • The samAccountName attribute is the user logon name used to support clients and servers from a previous version of Windows ( Pre-Windows 2000).
  • The user logon name format is : DomainName\testUser.
  • The samAccountName must be unique among all security principal objects within the domain.
  • The samAccountName should be less than 20 characters.
  • Query for the new name against the domain to verify that the samAccountName is unique in the domain.
  • The USERNAME environment variable is the samAccountName even when logging with UPN

UserPrincipalName - (UPN)

  • The UPN is an Internet-style login name for the user based on the Internet standard RFC 822.
  • The user logon name format is : testUser@DomainName.com.
  • The UPN must be unique among all security principal objects within the directory forest.
  • The advantage of using an UPN is that it can be the same as the users email address so that the user need to remember only a single name.
  • The UPN is optional, it can be assigned or not when the user account is created.
  • The userPrincipalName is unaffected by changes to other attributes of the user object, for example, if the user is renamed or moved, or changes to the domains in the tree, for example, if a parent domain was renamed or a domain was moved. Thus, a user can keep the same login name, although the directory may be radically restructured.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment