I just started with the PnP Provisioning schema. For a customer I need to built a template which contains a site collection and a team (which is obviously connected to this site).
It's necessary to run it without a logged in user as we gonna move it to Azure DevOps. So I created an app registration with a certificate and Api permissions:
The site is created but it stops with an exception. The site is however created with wrong settings (language incorrect, no additional owners, etc.) The error (Get-PnPException):
Object reference not set to an instance of an object. Stacktrace : at PnP.Framework.Graph.UnifiedGroupsUtility.d5.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 PnP.Framework.Graph.UnifiedGroupsUtility.<>cDisplayClass19_0.<b0>d
.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 PnP.Framework.Graph.UnifiedGroupsUtility.AddUnifiedGroupMembers(String groupId, String[] membe
rs, String accessToken, Boolean removeExistingMembers, Int32 retryCount, Int32 delay, AzureEnvironme
nt azureEnvironment)
at PnP.Framework.Sites.SiteCollection.d7.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 PnP.Framework.Sites.SiteCollection.d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at PnP.Framework.Provisioning.ObjectHandlers.ObjectHierarchySequenceSites.ProvisionObjects(Tenant
tenant, ProvisioningHierarchy hierarchy, String sequenceId, TokenParser tokenParser, ApplyConfigura
tion configuration)
at PnP.Framework.Provisioning.ObjectHandlers.SiteToTemplateConversion.ApplyTenantTemplate(Tenant
tenant, ProvisioningHierarchy hierarchy, String sequenceId, ApplyConfiguration configuration)
at PnP.PowerShell.Commands.Provisioning.Tenant.InvokeTenantTemplate.ExecuteCmdlet()
at PnP.PowerShell.Commands.PnPSharePointCmdlet.ProcessRecord()
I already did come investigation. Here are some findings:
When I execute the same with Connect-PnPOnline -Interactive it works. This is obviously as i'm using a global admin
When I first create the site with New-PnPSite and then invoke the template it also works.
When It fails the first time, I add the owner at group-level, invoke it again, it works.
I personally think is had something to do with the Graph Api, but I cannot find anything.
The template (I removed the parameters and header of the file as its not relevant)
Hi there,
I just started with the PnP Provisioning schema. For a customer I need to built a template which contains a site collection and a team (which is obviously connected to this site).
It's necessary to run it without a logged in user as we gonna move it to Azure DevOps. So I created an app registration with a certificate and Api permissions:
The site is created but it stops with an exception. The site is however created with wrong settings (language incorrect, no additional owners, etc.) The error (Get-PnPException):
Object reference not set to an instance of an object. Stacktrace : at PnP.Framework.Graph.UnifiedGroupsUtility.d5.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 PnP.Framework.Graph.UnifiedGroupsUtility.<>cDisplayClass19_0.<b0>d
.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 PnP.Framework.Graph.UnifiedGroupsUtility.AddUnifiedGroupMembers(String groupId, String[] membe
rs, String accessToken, Boolean removeExistingMembers, Int32 retryCount, Int32 delay, AzureEnvironme
nt azureEnvironment)
at PnP.Framework.Sites.SiteCollection.d 7.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 PnP.Framework.Sites.SiteCollection.d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at PnP.Framework.Provisioning.ObjectHandlers.ObjectHierarchySequenceSites.ProvisionObjects(Tenant
tenant, ProvisioningHierarchy hierarchy, String sequenceId, TokenParser tokenParser, ApplyConfigura
tion configuration)
at PnP.Framework.Provisioning.ObjectHandlers.SiteToTemplateConversion.ApplyTenantTemplate(Tenant
tenant, ProvisioningHierarchy hierarchy, String sequenceId, ApplyConfiguration configuration)
at PnP.PowerShell.Commands.Provisioning.Tenant.InvokeTenantTemplate.ExecuteCmdlet()
at PnP.PowerShell.Commands.PnPSharePointCmdlet.ProcessRecord()
I already did come investigation. Here are some findings:
I personally think is had something to do with the Graph Api, but I cannot find anything.
The template (I removed the parameters and header of the file as its not relevant)
`