Sql-server – SQL Server Service Accounts Max Character Length

service-accountssql server

I've been considering a new naming convention for all SQL Server service accounts for instances in our enterprise. I ran into some issues on my lab environment.

Is there a character limit to SQL Server service account names?

DOMAIN\SQL-Service-COMPUTER-NAME
DOMAIN\SQL-Agent-COMPUTER-NAME
DOMAIN\SQL-SSRS-COMPUTER-NAME
DOMAIN\SQL-SSAS-COMPUTER-NAME
DOMAIN\SQL-SSIS-COMPUTER-NAME

Best Answer

Within SQL Server, the datatype for the name column in sys.database_principles is sysname, which is essentially nvarchar(128). However, the sAMAccountName attribute in Active Directory specifies the login name must be 20 or fewer characters.

A similar question was posted within the forums on SQLServerCentral:

https://www.sqlservercentral.com/forums/topic/max-length-of-ad-names-for-security