Replies: 1 comment
-
I'm running into the same issue. I'm running a runbook in Powershell 7.2 with PnP.PowerShell version 2.2.0. Attempting to create a Team site using managed identity. It appears to be creating the site, adding the owners but interestingly does not associate it to the specified hub site despite that being specified in the New-PnPSite command. Returns a '401 Unauthorised' message. My managed identity is granted: I can run the same script using interactive login and it works without error. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have created an Azure function that uses the PnP cmdlets to automate the build of a communication or team site in SharePoint. The process works perfectly when building a communications site. However, it errors out when building the team site. Oddly enough, it does create the team site, associated group and adds the owners to the group, but errors out and does not complete the other tasks.
Here is part of the code in the function:
$siteName = "Team name here"
$siteURLLocal = "Team alias here"
$siteType = "TeamSite"
Connect-PnPOnline -Url $tenant -ManagedIdentity
New-PnPSite -Title $siteName -Type $siteType -Alias $siteURLLocal -Owners $owners
The results for the function include:
Our services aren't available right now
We're working to restore all services as soon as possible. Please check back soon.
Application insights for the function shows:
2023-01-09T21:10:00Z [Error] Executed 'Functions.CreateSPOSitePSFn' (Failed, Id=, Duration=300639ms)
2023-01-09T21:10:02Z [Warning] A function timeout has occurred. Restarting worker process executing invocationId ''.
If I run this same code on my PC with Windows PowerShell it runs fine.
The function is running PowerShell 7.0 due to a bug I saw in an article. The managed identity also has been assigned permissions.
Again, I am able to create a communication site without issue. The New-PnP syntax is slightly different for the comms site. Has anyone been able to do this successfully?
Beta Was this translation helpful? Give feedback.
All reactions