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

New-PnPSite -Type TeamSite Error when running the cmdlet #1179

Closed
JimmyHang opened this Issue Oct 27, 2017 · 18 comments

Comments

Projects
None yet
5 participants
@JimmyHang

JimmyHang commented Oct 27, 2017

###Notice: many issues / bugs reported are actually related to the PnP Core Library which is used behind the scenes. Consider carefully where to report an issue:###

  1. Are you using Apply-SPOProvisioningTemplate or Get-SPOProvisioningTemplate? The issue is most likely related to the Provisioning Engine. The Provisioning engine is not located in the PowerShell repo. Please report the issue here: https://github.com/officedev/PnP-Sites-Core/issues.
  2. Is the issue related to the cmdlet itself, its parameters, the syntax, or do you suspect it is the code of the cmdlet that is causing the issue? Then please continue reporting the issue in this repo.
  3. If you think that the functionality might be related to the underlying libraries that the cmdlet is calling (We realize that that might be difficult to determine), please first double check the code of the cmdlet, which can be found here: https://github.com/OfficeDev/PnP-PowerShell/tree/master/Commands. If related to the cmdlet, continue reporting the issue here, otherwise report the issue at https://github.com/officedev/PnP-Sites-Core/issues

Reporting an Issue or Missing Feature

Firstly I'll like to thank you all for the new "New-PnPSite" cmdlet, love it!
I'm getting an error when creating a modern teamsite

New-PnPSite -Type TeamSite -Title Teste0001 -Alias teste0001

Expected behavior

Expected a new group to be created

Actual behavior

New-PnPSite : {"d":{"CreateGroupEx":{"__metadata":{"type":"Microsoft.SharePoint.Portal.GroupSiteInfo"},"DocumentsUrl":null,"ErrorMessage":null,"GroupId":"9c0f498a-1672-4ab7-ad82-c32
2aeb0ab79","SiteStatus":1,"SiteUrl":null}}}
At line:1 char:1

  • New-PnPSite -Type TeamSite -Title Teste0001 -Alias teste0001
  •   + CategoryInfo          : WriteError: (:) [New-PnPSite], Exception
      + FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.NewSite
    
    

Steps to reproduce behavior

New-PnPSite -Type TeamSite -Title Teste0001 -Alias teste0001

Which version of the PnP-PowerShell Cmdlets are you using?

  • PnP PowerShell for SharePoint 2013
  • PnP PowerShell for SharePoint 2016
  • [ x] PnP PowerShell for SharePoint Online

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

SharePointPnPPowerShellOnline 2.19.1710.2
SharePointPnPPowerShellOnline 2.18.1709.1
SharePointPnPPowerShellOnline 2.17.1708.1
SharePointPnPPowerShellOnline 2.16.1706.0

How did you install the PnP-PowerShell Cmdlets?

  • MSI Installed downloaded from GitHub
  • [x ] Installed through the PowerShell Gallery with Install-Module
  • Other means
@erwinvanhunen

This comment has been minimized.

Collaborator

erwinvanhunen commented Nov 19, 2017

Does this error occur every time you want to create a new team site? I just tested it and I cannot reproduce this issue on my own tenant.

@mmsharepoint

This comment has been minimized.

mmsharepoint commented Nov 23, 2017

Today it started that I face the same issue on several tenants at my customer.
So far I am not sure if it occurs from time to time or now always but I already failed several times with the command and we are using 2.20.1711.0
In the past days and weeks the cmd looked very stable to me we had much more issues with New-PnPUnifiedGroup in the weeks before
Let me know if I can do something for investigation as well

@erwinvanhunen

This comment has been minimized.

Collaborator

erwinvanhunen commented Nov 23, 2017

The moment the error occurs again, can you please execute

$error[0].Exception.Stacktrace

I'm wondering if it is a server or client side issue. If is a server side issue we have to hook in SP Engineering.

@erwinvanhunen

This comment has been minimized.

Collaborator

erwinvanhunen commented Nov 23, 2017

Right, we're seeing it on our end too now. We are investigating what is causing it.

@mmsharepoint

This comment has been minimized.

mmsharepoint commented Nov 23, 2017

I was just investigating what is the result I got so far:
The server was reached as I

  • got a Group listed in the admin center
  • Get-PnPUnifiedGroup also tells me it is there (I use this to check if the alias a user requests is "free" in our provisioning process which we have in an Azure Runbook)
  • got a "half created" group in Outlook which tells me "Your request can't be completed right now. Please try again later."
  • No Site got created but recieving a 404 when requesting the Url which it should have

As you can reproduce, too Erwin, you will narrow down and try to isolate it? Smells like something changed in the backend the code relies on, right?
I can still try it manual and execute the "stacktrace" you mentioned, if needed.
And will also check to put it in my PowerShell catch clause in the runbook
Thanks for your incredible work by the way
Markus

@erwinvanhunen

This comment has been minimized.

Collaborator

erwinvanhunen commented Nov 23, 2017

As we only fire off the request to make the site and we wait for an 'ok' to return, it's most likely some issue with the back end indeed as parts get created.

@erwinvanhunen

This comment has been minimized.

Collaborator

erwinvanhunen commented Nov 23, 2017

Okay, we're a step further. For unknown as yet reasons, modern site creation is slower today. The site creation process returns a status 1, which means that the request is executed but the site is still provisioning. The code we use parses the result and if site status is 2, it returns the URL, otherwise it returns an exception. While technically speaking status 1 is not an error, more a 'please wait longer, we're are still working on it' kind of message.

@mmsharepoint

This comment has been minimized.

mmsharepoint commented Nov 23, 2017

Then I will be interested if the Group gets fully created some time later?
Btw. (Shame on me I did not raise an issue so far) New-PnPUnifiedGroup from time to time created Groups for me without a site. Although I receive a "Wait while we get things created for you" (or similar) message this did not happen for days.
Let's see how it goes in this time and if our groups get fully created after a while?

@mmsharepoint

This comment has been minimized.

mmsharepoint commented Nov 23, 2017

I just paste in the full stacktrace that I got for "Google" and others that might face the issue:
$error[0].Exception.Stacktrace
at OfficeDevPnP.Core.Sites.SiteCollection.d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.SharePoint.Client.ClientContextExtensions.d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at SharePointPnP.PowerShell.Commands.NewSite.ExecuteCmdlet()
at SharePointPnP.PowerShell.Commands.PnPCmdlet.ProcessRecord()

@JimmyHang

This comment has been minimized.

JimmyHang commented Nov 30, 2017

I just run the command again today, and it's working as expected,

@mmsharepoint

This comment has been minimized.

mmsharepoint commented Dec 1, 2017

Indeed it's running perfectly again.
I only wonder if @erwinvanhunen is thinking about a different handling of the situation he described above and I discovered at least once (very short, next try 5mins later worked) again.

@JimmyHang

This comment has been minimized.

JimmyHang commented Jan 12, 2018

Hi @erwinvanhunen, a quick update here, this stopped working in after updated the PnP module to the below versions, it works if i rollback to version: 2.20.1711.0

SharePointPnPPowerShellOnline 2.22.1801.0
SharePointPnPPowerShellOnline 2.21.1712.2

$siteUrl = New-PnPSite -Type TeamSite -Title "Testing002" -Alias "Testing002"
$error[0].Exception.Stacktrace

New-PnPSite : App-Only is currently not supported.
At line:1 char:12

  • $siteUrl = New-PnPSite -Type TeamSite -Title "Testing002" -Alias "Tes ...

  •        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : WriteError: (:) [New-PnPSite], Exception
    • FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.NewSite

    at OfficeDevPnP.Core.Sites.SiteCollection.d__1.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Microsoft.SharePoint.Client.ClientContextExtensions.d__17.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at SharePointPnP.PowerShell.Commands.NewSite.ExecuteCmdlet()
    at SharePointPnP.PowerShell.Commands.PnPCmdlet.ProcessRecord()

@mmsharepoint

This comment has been minimized.

mmsharepoint commented Jan 12, 2018

Cannot confirm that. We are also using 2.22.1801.0 and New-PnPSite together with Groups / Teamsite creation works fine
But "App-Only is currently not supported." makes me assume that you connect with AppID / AppSecret?
This indeed is not supported but by the underlying Rest Api as well I was told

@JimmyHang

This comment has been minimized.

JimmyHang commented Jan 13, 2018

Hi @mmsharepoint, thanks for the reply. I'm not authenticating using an AppID, but since the account is global admin it has MFA enabled, and i was using -UseWeblogin "Connect-PnPOnline -Url https://$tenant.sharepoint.com -UseWebLogin" I can confirm that when using another account without MFA version 2.22.18010 works as expected.

@OvidiuSt

This comment has been minimized.

OvidiuSt commented Jan 31, 2018

I confirm the same behavior as @JimmyHang.

  1. Reverting back to November build it works
  2. Whenever -UseWebLogin is used with January build I have the same issue:
    New-PnPSite : App-Only is currently not supported.
@erwinvanhunen

This comment has been minimized.

Collaborator

erwinvanhunen commented Feb 21, 2018

Unfortunately, using weblogin based auth will not work when creating new sites using New-PnPSite. See my answer here: #1351

@erwinvanhunen

This comment has been minimized.

Collaborator

erwinvanhunen commented Feb 21, 2018

I actually have to correct myself. After investigating this a bit more I actually found a workaround. I will merge this into the Core Library after testing.

@raymondlittle100

This comment has been minimized.

raymondlittle100 commented Aug 24, 2018

Got this again today with version 3.0.1808.1. For me it seemed to be an account issue. I was running this as a SP admin but it would only work if the account was a global admin, guessing this is because it needs to create the O365 group.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment