Mailbox does not share with users's email - Exchange Online Powershell

Abhishek Goyal 246 Reputation points
2023-09-12T07:24:59.67+00:00

My situation is - I have created a user on Azure AD with UPN "user.upn@domain.com" and its email is "user.email@domain.com". Then, create one more user with UPN "abhishek.goyal@domain.com" and assign it an exchange license.

After that, I want to share its mailbox with the user with UPN "user.upn@domain.com". The command that I use:

Add-MailboxPermission -Identity abhishek.goyal@domain.com -User user.email@domain.com -AccessRights FullAccess -InheritanceType All

According to Microsoft docs, the possible value that I can provide with -User attributes are:

  • Name
  • Alias
  • Distinguished name (DN)
  • Canonical DN
  • Domain\Username
  • Email address
  • GUID
  • LegacyExchangeDN
  • SamAccountName
  • User ID or user principal name (UPN)

So, according to that possible values the mailbox has to be shared with the user's email address.

My Output,

If email address is same as UPN then it shared successfully.

If email address is different with UPN then it give error-

Error.png

Please help me with it.

Microsoft Exchange Online
0 comments No comments
{count} votes

Accepted answer
  1. Yuki Sun-MSFT 41,046 Reputation points Microsoft Vendor
    2023-09-13T05:32:48.8666667+00:00

    Hi @Abhishek Goyal ,

    I have created a user on Azure AD with UPN "user.upn@domain.com" and its email is "user.email@domain.com".

    Is the "Email" property added in Azure AD portal? If so, it could be an expected behavior as this doesn't mean the user is already a real mailbox user. While the Microsoft Doc you shared earlier states that, "You can specify the following types of users or groups (security principals) for this parameter:

    • Mailbox users
    • Mail users
    • Mail-enabled security groups (non-mail-enabled security groups are selectable, but they don't work)"

    Could you have a look at the Microsoft 365 admin center, find this user and click the Mail tab? If the below warning prompt, please assign an Exchange Online license for this user as well so that it can has a real mailbox:User's image

    I just tried testing in my lab tenant by creating a user in Azure AD with UPN "user5@contoso.com" and Email "user5email@contoso.com", I can replicate the error you met when trying to grant user5 the full access permission to another existent user. However, after adding the Exchange Online license for user5, the same command can be ran successfully: User's image


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Vasil Michev 103.7K Reputation points MVP
    2023-09-12T17:12:57.7033333+00:00

    What you are describing is indeed a supported scenario, the cmdlet should accept any of the email addresses configured on a given mailbox as input for the -User parameter. However, assigning an Exchange license to the user doesn't necessarily mean that a mailbox will be provisioned, in which case Exchange might not "know" about any additional email addresses. In other words, you need to check whether the given address is a valid "recipient", which is easily done via the Get-Recipient cmdlet.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.