Unable to create Distribution lists using exchange online with app-only authentication(Azure AD Application) with exchange online

Mariyada, Ajaynath Reddy 0 Reputation points
2024-05-27T15:14:53.4866667+00:00

Requirement: To create Distribution lists using exchange online with app-only authentication.

Description:

  1. I am using Azure AD credentials to connect to exchange online, because i wanted to create distribution lists automatically without user involvement.
  2. After authentication, whenever I am using commands like New-DistributionGroup, Add-DistributionGroupMember,Remove-DistributionGroup ,Remove-DistributionGroupMember ,Update-DistributionGroupMember an error showing like below

New-DistributionGroup : "The term 'New-DistributionGroup' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the

spelling of the name, or if a path was included, verify that the path is correct and try again".

  • New-DistributionGroup
  • 
    
  • CategoryInfo : ObjectNotFound: (New-DistributionGroup:String) [], CommandNotFoundException
  • FullyQualifiedErrorId : CommandNotFoundException
Exchange Online
Exchange Online
A Microsoft email and calendaring hosted service.
6,171 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Vasil Michev 119.5K Reputation points MVP Volunteer Moderator
    2024-05-27T16:53:09.3866667+00:00

    Did you assign a matching admin role to the service principal corresponding to your app? The "Exchange Recipient Management" role or equivalent role/role group in Exchange Online is required.


  2. Anonymous
    2024-05-28T08:00:36.3133333+00:00

    Hi,@Mariyada, Ajaynath Reddy

    Thanks for posting your question in the Microsoft Q&A forum.

    When you run New-DistributionGroup, a message appears that the command is not recognized.

    If only administrator role are not enough, a query reveals that it also requires the "Recipient Management" or "Security Administrator" roles.

    A computer screen with white textDescription automatically generated

    You can add users to role groups  in EAC- Admin roles.

    A screenshot of a computerDescription automatically generated

    If my answer is helpful to you, please mark it as the answer so that other users can refer to it. Thank you for your support and understanding.


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.