Skip to content

Instantly share code, notes, and snippets.

@nordineb
Created October 11, 2017 14:42
Show Gist options
  • Save nordineb/c6b039d7d56ae5d7f3af36bb098b3c3a to your computer and use it in GitHub Desktop.
Save nordineb/c6b039d7d56ae5d7f3af36bb098b3c3a 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 [email protected].

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 : [email protected].
  • 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