Forum Discussion
Command New-DistributionGroup doesn't work
- Aug 08, 2023
Hi, Eduardo.
That's what I was expecting to hear.
The commandlet definitely exists, however, when you run Connect-ExchangeOnline, only the commandlets you have access to are loaded.
If you don't see a particular command, it means the account you have logged in with during Connect-ExchangeOnline does not have enough access to see and use that commandlet.
Using the following article's guidance, we can see which roles give access to New-DistributionGroup:
(Get-ManagementRole -Cmdlet New-DistributionGroup).Name | ForEach-Object { Get-ManagementRoleAssignment -Role $_ -Delegating:$false | Format-Table -AutoSize Role, RoleAssigneeType, RoleAssigneeName; }
Output:
So, we can see from this that the account you logged in with using Connect-ExchangeOnline needs to be a member of either:
- Organization Management
- Recipient Management
The one thing that is for certain is that if you're not seeing the command, your account does not have the necessary rights to do so. It's not a problem with the commandlet not existing.
Cheers,
Lain
Hello Lain,
Thank you very much for your quick Response.
I have executed the commands you suggested and from the response I see on the screen, my accesses are correct and active.
In the last command I don't see: New-DistributionGroup, it means it doesn't exit ?
Is the New-DistributionGroup command active for you?
Cheers,
Eduardo
Hi, Eduardo.
That's what I was expecting to hear.
The commandlet definitely exists, however, when you run Connect-ExchangeOnline, only the commandlets you have access to are loaded.
If you don't see a particular command, it means the account you have logged in with during Connect-ExchangeOnline does not have enough access to see and use that commandlet.
Using the following article's guidance, we can see which roles give access to New-DistributionGroup:
(Get-ManagementRole -Cmdlet New-DistributionGroup).Name |
ForEach-Object {
Get-ManagementRoleAssignment -Role $_ -Delegating:$false | Format-Table -AutoSize Role, RoleAssigneeType, RoleAssigneeName;
}
Output:
So, we can see from this that the account you logged in with using Connect-ExchangeOnline needs to be a member of either:
- Organization Management
- Recipient Management
The one thing that is for certain is that if you're not seeing the command, your account does not have the necessary rights to do so. It's not a problem with the commandlet not existing.
Cheers,
Lain
- asad_naseerJan 16, 2024Copper Contributor
Hi LainRobertson,@Eduardo_Ricardez
It works fine as per the given solution.
Now the point is how we can assign "Organization Management" and "Recipient Management" role to an "Azure Application" to get an access for creating distribution group and the required functionality.
Thanks
- Eduardo_RicardezAug 08, 2023Copper ContributorLain,
You were right, I have now added the missing roles to the account and was able to use the New-DistributiuonGroup command.
Again thank you very much for your patience and help.
Cheers,
Eduardo- LainRobertsonAug 08, 2023Silver Contributor
No problem!
Glad you got it sorted, and you'll get used to PowerShell quickly - you're doing fine already.
Cheers,
Lain