Shared or resource mailbox UPN and SamAccountName contain a GUID

Symptoms

You create a shared mailbox or a resource mailbox in the Exchange admin center (EAC) or by using the New-Mailbox PowerShell cmdlet. When you create the mailbox, you don't specify the UserPrincipalName (UPN) and SamAccountName property values. When you check the default UserPrincipalName and SamAccountName values that Microsoft Exchange Server assigns to the new mailbox, you see that they each contain a GUID.

For example, you run the following PowerShell commands:

New-Mailbox -Shared -Name <mailbox name> -Alias <mailbox alias>
Get-Mailbox <mailbox alias> | FL UserPrincipalName,SamAccountName

You expect to see the following output:

UserPrincipalName : <mailbox alias>@<your domain>
SamAccountName : <mailbox alias>

However, you see the following output instead:

UserPrincipalName : <GUID>@<your domain>
SamAccountName : <GUID>

Cause

The issue occurs if the mailbox alias meets any of the following criteria:

  • Contains characters that aren't letters, numerals, periods, hyphens, or underscores

  • Starts with a character that isn't a letter

  • Ends in a period

  • Contains consecutive periods

  • Is longer than 63 characters

Status

This behavior is by design to make sure that the UserPrincipalName and SamAccountName property values for a mailbox are unique.

Resolution

If you don't want the UserPrincipalName and SamAccountName property values to contain a GUID, you can manually assign the values when you create a shared or resource mailbox. Use the New-Mailbox PowerShell cmdlet together with the UserPrincipalName and SamAccountName parameters. For example, run the following command:

New-Mailbox -Room -Name Conference -Alias "12" -UserPrincipalName "12@contoso.com" -SamAccountName "12"

For an existing shared or resource mailbox that contains a GUID in the UserPrincipalName and SamAccountName property values, you can update the values by using the Set-Mailbox PowerShell cmdlet together with the UserPrincipalName and SamAccountName parameters. For example, run the following command:

Get-Mailbox "12" | Set-Mailbox -UserPrincipalName "12@contoso.com" -SamAccountName "12"