powershell icon indicating copy to clipboard operation
powershell copied to clipboard

[BUG] Add-PnPTeamsTeam throwing Authentication Method is not allowed

Open prawnz opened this issue 5 years ago • 5 comments

Reporting an Issue or Missing Feature

I am using a certificate authentication method which is created using the Register-PnPAzureADApp with Connect-PnPOnline. When I try to user Add-PnPTeamsTeam with a modern team site is created using New-PnPSite -Type "TeamSite" -Title $siteTitle -Alias $groupAlias -IsPublic -Wait

I am getting Authentication method not allowed as shown [DBG]: PS C:\Projects\DOF-M365Provisioning> Add-PnPTeamsTeam Add-PnPTeamsTeam: {"odata.error":{"code":"10005","message":{"lang":"en-US","value":"Authentication method is not allowed."}}}

Expected behavior

I am expecting the Add-PnpTeamsTeam cmdlet to complete.

Steps to reproduce behavior

Connect-PnPOnline -URL "https://$($tenantName)-admin.sharepoint.com" -ClientId $appRegistrationClientIdValue -Thumbprint $certThumbprintValue -Tenant $tenantIdValue $tenantSite = New-PnPSite -Type "TeamSite" -Title $siteTitle -Alias $groupAlias -IsPublic -Wait $tenantSiteUrl = $($tenantSite.Url) Connect-PnPOnline -URL $tenantSiteUrl -ClientId $appRegistrationClientIdValue -Thumbprint $certThumbprintValue -Tenant $tenantIdValue Add-PnPTeamsTeam

What is the version of the Cmdlet module you are running?

PnP.Powershell 1.4.0

Which operating system/environment are you running PnP PowerShell on?

  • [x] Windows
  • [ ] Linux
  • [ ] MacOS
  • [ ] Azure Cloud Shell
  • [ ] Azure Functions
  • [ ] Other : please specify

prawnz avatar Mar 19 '21 06:03 prawnz

@prawnz - This is a known issue for app-only context. You can use this command only with delegated permissions and user context due to limitations of SharePoint APIs.

If you wish you use app-only context, would suggest that you use

New-PnPMicrosoft365Group cmdlet and use -CreateTeam parameter. It does the same thing but uses Graph endpoints which support app-only scenarios.

gautamdsheth avatar Mar 31 '21 14:03 gautamdsheth

@gautamdsheth all good.. will use your suggested method.

prawnz avatar Mar 31 '21 14:03 prawnz

@gautamdsheth all good.. will use your suggested method.

When I try to use New-PnPMicrosoft365Group with the parameter -CreateTeam I get this error

Failed
Empty Payload. JSON content expected. (Empty Payload. JSON content expected.)

But the O365 group and teamsite is created correctly. I use the command in an Azure RunBook with the PnP PowerShell Version 1.4.0.

TheHailender avatar Apr 08 '21 13:04 TheHailender

uuh sorry, an update to 1.5.0 solves the problem

TheHailender avatar Apr 08 '21 13:04 TheHailender

I am facing the same issue with PnP.PowerShell version 1.5.0

I have added all the details in this issue

mohandivraniya avatar May 04 '21 05:05 mohandivraniya