Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] #4083

Open
hajjkh opened this issue Jul 9, 2024 · 1 comment
Open

[BUG] #4083

hajjkh opened this issue Jul 9, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@hajjkh
Copy link

hajjkh commented Jul 9, 2024

I try to groupify a SharePoint site by an Azure function under an managed identity. I can do many actions by a managed identity like create a new site, provision a pnp template, set theme, add group owners and members. But I cannot groupify a SharePoint team site. I got this error:

2024-07-09T18:46:25Z   [Error]   ERROR: An error occurred while processing this request.

Exception             : 
    Type        : System.Management.Automation.PSInvalidOperationException
    ErrorRecord : 
        Exception             : 
            Type    : System.Management.Automation.ParentContainsErrorRecordException
            Message : An error occurred while processing this request.
            HResult : -2146233087
        CategoryInfo          : InvalidOperation: (:) [], ParentContainsErrorRecordException
        FullyQualifiedErrorId : InvalidOperation
    TargetSite  : 
        Name          : ProcessRecord
        DeclaringType : PnP.PowerShell.Commands.Base.PnPConnectedCmdlet
        MemberType    : Method
        Module        : PnP.PowerShell.dll
    Message     : An error occurred while processing this request.
    Source      : PnP.PowerShell
    HResult     : -2146233079
    StackTrace  : 
   at PnP.PowerShell.Commands.Base.PnPConnectedCmdlet.ProcessRecord() in c:\build\src\Commands\Base\PnPConnectedCmdlet.cs:line 101
   at PnP.PowerShell.Commands.PnPSharePointCmdlet.ProcessRecord() in c:\build\src\Commands\Base\PnPSharePointCmdlet.cs:line 131
   at System.Management.Automation.Cmdlet.DoProcessRecord()
   at System.Management.Automation.CommandProcessor.ProcessRecord()
CategoryInfo          : InvalidOperation: (:) [Add-PnPMicrosoft365GroupToSite], PSInvalidOperationException
FullyQualifiedErrorId : InvalidOperation,PnP.PowerShell.Commands.Admin.AddMicrosoft365GroupToSite
InvocationInfo        : 
    MyCommand        : Add-PnPMicrosoft365GroupToSite
    ScriptLineNumber : 28
    OffsetInLine     : 1
    HistoryId        : 1
    ScriptName       : C:\home\site\wwwroot\ModifyExistingSite\run.ps1
    Line             : Add-PnPMicrosoft365GroupToSite -Url $targetProjectSiteURL -Alias "contosokhha" -DisplayName "contosokhha" -KeepOldHomePage
                       
    PositionMessage  : At C:\home\site\wwwroot\ModifyExistingSite\run.ps1:28 char:1
                       + Add-PnPMicrosoft365GroupToSite -Url $targetProjectSiteURL -Alias "con …
                       + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    PSScriptRoot     : C:\home\site\wwwroot\ModifyExistingSite
    PSCommandPath    : C:\home\site\wwwroot\ModifyExistingSite\run.ps1
    InvocationName   : Add-PnPMicrosoft365GroupToSite
    CommandOrigin    : Internal
ScriptStackTrace      : at <ScriptBlock>, C:\home\site\wwwroot\ModifyExistingSite\run.ps1: line 28


Expected behavior
I expect no errors, and a group based SharePoint site

Steps to reproduce behavior

Connect-PnPOnline -ManagedIdentity -Url "[https://myCompany-admin.sharepoint.com"
Add-PnPMicrosoft365GroupToSite -Url "https://myCompany.sharepoint.com/teams/someNonGroupBasedTeamSite" -Alias "someNonGroupBasedTeamSite" -DisplayName "someNonGroupBasedTeamSite" -KeepOldHomePage

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

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

I implemented these API permissions on my managed itentity/azure function. Do I miss some API permission?

image

@hajjkh hajjkh added the bug Something isn't working label Jul 9, 2024
@jackpoz
Copy link
Contributor

jackpoz commented Jul 9, 2024

I can confirm the same issue when connecting with app id and certificate:
image

When connecting with -Interactive , somehow I get a different error:
Add-PnPMicrosoft365GroupToSite: User does not have permissions to Groupify

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants