There are some known issues around using the Unified group cmdlets with CBA, Microsoft is working on addressing them.
Unable to manage microsoft 365 groups using PowerShell cmdlet

Hello
I would like to create, delete and add member in a Micorosft 365 group using powershell. The commands I used are : New-UnifiedGroup, Add-UnifiedGroupLinks, and Remove-UnifiedGroup .
So I have created a first script that connect using the login (e-mail) and pasword and passing the option '-Credential' to the cdmlets : Connect-ExchangeOnline and Connect-AzureAD. And in this case, I managed to do everything I want.
However, I have created a second script where we use certificate to connect to the Administrative server.
I have followed these documentation :
- this one to connect with 'Connect-ExchangeOnline' cmdlet : https://learn.microsoft.com/en-us/powershell/exchange/app-only-auth-powershell-v2?view=exchange-ps
- this one to use 'Connect-AzureAD' cmdlet : https://learn.microsoft.com/en-us/powershell/module/azuread/connect-azuread?view=azureadps-2.0
I manage to connect to the server using certificates, so I connect using ' Connect-ExchangeOnline -AppId $appID -CertificateThumbprint $thumbPrint -CertificatePassword $securePasswd -Organization $organisation' and ' Connect-AzureAD -TenantId $tenantID -ApplicationId $appID -CertificateThumbprint $thumb'
And in this case, any of these three commands I want to use (New-UnifiedGroup, Add-UnifiedGroupLinks, and Remove-UnifiedGroup) are NOT working ... And I get this kind of error :
And if I want to create a unified group
And if I want to remove an existing "microsoft 365" group
And all the other commands I use in my script like : Set-AzureADUserLicense, Add-DistributionGroupMember, New-Mailbox, Add-MailboxPermission, Add-RecipientPermission works nice and perfectly.
So why do I get these kind of errors ? Did you had the same problem and may you have a solutions for it ?
I need to use certificate instead of a classical login and password, it is very usefull and mandatory for my script.
Thank you for your answers
2 answers
Sort by: Most helpful
-
answered
2021-04-16T17:19:32.993+00:00 Vasil Michev 61,366 Reputation points Microsoft MVP -
answered
2022-08-15T16:48:58.19+00:00 Arant, Kenneth 1 Reputation pointAny update on this issue?