Search code examples
azureactive-directoryazure-active-directory

What is the maximum length of an Azure Active Directory (AAD) username?


I'm trying to find the maximum length of an Azure Active Directory (AAD) username. The username is UPN-formatted (username@domain), so presumably there are two string length limits for the username and domain fields.

All I can find online is the maximum length of either a standard Windows user or a Windows Domain user, which is 20 characters. Is Azure the same? And presumably that's just for the username so what is the limit on the domain string?


Solution

  • The maximum length for an AAD username (without domain) is 64 characters.

    The maximum length for an AAD custom domain is 48 characters.

    For a non-custom (*.onmicrosoft.com) domain, the string length limit is 27 characters. As ".onmicrosoft.com" is 16 characters, this adds up to a 43-character limit in total, slightly less than the custom domain limit.

    So overall, a username in the UPN format (username@domain) has a total string length limit of 113 characters.

    These figures can be found on the official Microsoft documentation here