Fix : BadRequest – Invalid value specified for property ‘mailNickname’ of resource ‘User’

Problem

You might have received the error “Invalid value specified for property ‘mailNickname’ of resource ‘User'” error when you create a new Azure AD user.

Cause/Solution

As the error message indicates the provided mail alias name is not in correct format or it includes invalid special characters. So try the below cases to fix this problem.

  • Remove white spaces in mailNickname (mail alias, email address).
  • Remove special characters in mailNickname (Ex: Space and “(),:;<>@[]).

Valid and Invalid characters in mailNickname/mailAlias

The mailNickname or mail alias of the email address may use any of these ASCII characters RFC 5322 Section 3.2.3:

  • Uppercase and lowercase English letters (a–z, A–Z) (ASCII: 65-90, 97-122)
    – Digits 0 to 9 (ASCII: 48-57).
  • Characters !#$%&’*+-/=?^_`{|}~ (ASCII: 33, 35-39, 42, 43, 45, 47, 61, 63, 94-96, 123-126).
  • Character . (dot, period, full stop) (ASCII: 46) provided that it is not the first or last character, and provided also that it does not appear two or more times consecutively (e.g. [email protected] is not allowed.).

Special characters with restrictions:

Special characters are allowed with restrictions. They are:
– Space and “(),:;<>@[] (ASCII: 32, 34, 40, 41, 44, 58, 59, 60, 62, 64, 91-93).

The restrictions for special characters are that they must only be used when contained between quotation marks, and that 3 of them (The space, backslash and quotation mark ” (ASCII: 32, 92, 34)) must also be preceded by a backslash (e.g. ” “”).

Note : You can also apply the same fix for group creation issue (group mail alias issue) – Invalid value specified for property ‘mailNickname’ of resource ‘Group’.

Source : What are valid and invalid email address characters

Advertisement

1 thought on “Fix : BadRequest – Invalid value specified for property ‘mailNickname’ of resource ‘User’”

Leave a Comment