-
Notifications
You must be signed in to change notification settings - Fork 332
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] New-PnpSite with Managed Identity gives "Object reference not set to an instance of an object. " but still creates the Site #4082
Comments
Could you try passing |
This is the Exception I'm getting:
|
That shows that it's line powershell/src/Commands/Admin/NewSite.cs Line 145 in 15497cc
returnedContext being null.Do you know if the site was created ? |
The site and the coresponding Group are being created. I can navigate to it. The Owner is set. But your comment brought me to a possible cause. The SharePoint is almost at its limit space wise. Could that cause the lead to the cmdlet not being able to find the URL after creation? |
Reporting an Issue or Missing Feature
I'm using the "New-PnPSite" cmdlet inside of a Runbook, which is used with a Managed Identity.
The Managed Idetity has the following Permissions:
I connect to the SharePoint Admin Site the following way:
$ConnectionAdminCenter = Connect-PnPOnline -Url "https://tenant-admin.sharepoint.com" -ManagedIdentity -ReturnConnection
And then use the "New-PnpSite" cmdlet this way:
New-PnPSite -Type TeamSite -Alias "Site-Alias" -Title "Site-Name" -Description "Description" -Owners "owner@tenant.com" -Lcid 1031 -Wait -Connection $ConnectionAdminCenter
When I try to create a "TeamSiteWithoutMicrosoft365Group" it works without issue.
Expected behavior
The Site will be created with the parameters given. After that the runbook will continue with what comes afterwards.
Actual behavior
The Site is created and after about 10 minutes the Runbook shows the Status "Error" and in the "Exceptions" Tab I see:
Object reference not set to an instance of an object. (Object reference not set to an instance of an object.)
What is the version of the Cmdlet module you are running?
I'm running Version 2.5.12-nightly of the PnP.Module.
Which operating system/environment are you running PnP PowerShell on?
The text was updated successfully, but these errors were encountered: