question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Invoke-PnPSiteTemplate System.UnauthorizedAccessException Error applying default column values

See original GitHub issue

Scenario: A PnP template that has been working for a long time and has been successfully applied to more than 50 sites, working yesterday at 5pm, suddenly (but consistently) since then now failing when running Invoke-PnPSiteTemplate. The output to the PowerShell console says Error applying default column values but the trace log says System.UnauthorizedAccessException (see below)

The same template applies ok in a different non-production tenant. Any ideas how I debug this?

Error from Set-PnPTraceLog:

pwsh Information: 0 : 2023-02-24 09:28:21.2563 [List instances] [20] [Debug] Creating view Workspace 33258ms 79ac16c2-5903-4744-9cb1-7e66d20e6953 pwsh Information: 0 : 2023-02-24 09:28:21.7511 [List instances] [20] [Debug] Creating view All Items 33753ms 79ac16c2-5903-4744-9cb1-7e66d20e6953 pwsh Information: 0 : 2023-02-24 09:28:22.2736 [List instances] [20] [Debug] Creating view All Items 34275ms 79ac16c2-5903-4744-9cb1-7e66d20e6953 pwsh Information: 0 : 2023-02-24 09:28:22.7679 [List instances] [20] [Debug] Creating view All Items 34770ms 79ac16c2-5903-4744-9cb1-7e66d20e6953 pwsh Error: 0 : 2023-02-24 09:28:24.1627 [PnP.Framework] [0] [Error] ExecuteQuery threw following exception: Microsoft.SharePoint.Client.ServerUnauthorizedAccessException: Attempted to perform an unauthorized operation. at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream) at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse() at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServerAsync(ChunkStringBuilder sb) at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryAsync() at Microsoft.SharePoint.Client.ClientRuntimeContext.ExecuteQueryAsync() at Microsoft.SharePoint.Client.ClientContext.ExecuteQueryAsync() at Microsoft.SharePoint.Client.ClientContextExtensions.ExecuteQueryImplementation(ClientRuntimeContext clientContext, Int32 retryCount, String userAgent) ServerErrorCode: -2147024891 ServerErrorTypeName: System.UnauthorizedAccessException ServerErrorTraceCorrelationId: d64e99a0-60b2-6000-3b7f-0053ec780ba4 ServerErrorValue: ServerErrorDetails: . 0ms pwsh Information: 0 : 2023-02-24 09:28:24.1632 [List instances] [20] [Debug] Code execution scope ended 36165ms 79ac16c2-5903-4744-9cb1-7e66d20e6953 pwsh Information: 0 : 2023-02-24 09:28:24.1633 [ProvisioningTemplate WebHook Call] [20] [Debug] Code execution scope started 0ms 79ac16c2-5903-4744-9cb1-7e66d20e6953 pwsh Information: 0 : 2023-02-24 09:28:24.1633 [ProvisioningTemplate WebHook Call] [20] [Debug] Code execution scope ended 0ms 79ac16c2-5903-4744-9cb1-7e66d20e6953 pwsh Information: 0 : 2023-02-24 09:28:24.1634 [Provisioning] [20] [Debug] Code execution scope ended 102344ms 79ac16c2-5903-4744-9cb1-7e66d20e6953

Issue Analytics

  • State:closed
  • Created 7 months ago
  • Reactions:4
  • Comments:7

github_iconTop GitHub Comments

2reactions
anthonywhitecommented, Mar 7, 2023

@popoygaming

It was mysteriously fixed in our tenant just today. Wondering if the same happened to your tenants?

yes, just checked and the Jackpoz repro https://github.com/pnp/powershell/issues/2814#issuecomment-1433424132 now works

Is there a messaging from MSFT about this sudden fix?

despite an open support ticket since last Friday, radio silence. UPDATE: we have been told that a SharePoint Product Group update has been recognised as causing this issue, and retracted. I have no link to a public statement however.

Just worried that this issue might happen again.

So am I. I expect we all are. But at least this time the PnP community has rocked…

1reaction
amalitabosecommented, Mar 1, 2023

@popoygaming Just now checked, even in my tenant its now working.

@anthonywhite @markgort86

Read more comments on GitHub >

github_iconTop Results From Across the Web

Invoke-PnPSiteTemplate : Error applying default column ...
When trying to apply the same template in a tenant B (where I have less administrative roles than tenant A), everything works as...
Read more >
[BUG] Set-PnPDefaultColumnValues throws ...
This is via application permissions. Expected behavior. The default value should be set without error. Actual behavior.
Read more >
SharePoint Modern Site PnP provisioning issues with Lists
1 Answer. Check to see that the columns "Report_x0020_Description" is in the site columns list of the destination site. It may be that...
Read more >
Error in PnP Provisioning script in SharePoint Online
My script is not working after that and showing the below error. Invoke-PnPSiteTemplate : Error applying default column values At ...
Read more >
Invoke-PnPSiteTemplate | PnP PowerShell
Applies a site template in XML format to the current web. It will populate the parameter in the template the values as specified...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found