Fix SharePoint PnP Provisioning Template Access Token Required Error
Question details
Users experience an access token requirement error when trying to apply a SharePoint Online provisioning template via PowerShell.

- Product
- SharePoint Online PnP PowerShell
- Device & OS
- not provided
- Scenario
- Applying a site provisioning template using PnP PowerShell.
- Observed behavior
- The PowerShell execution throws an error stating that template artifacts require an access token and requests consent for the PnP Management Shell application, often caused by header and footer layout components.
Ensure you have the latest version of the PnP PowerShell module installed and that you have sufficient administrator privileges to modify the target SharePoint site and edit the SiteTemplate.xml file.
Remove Header and Footer Layout Components
Bypassing the header and footer nodes within your SiteTemplate.xml will prevent the access token request and allow the main template to be provisioned.
The access token requirement is often triggered by specific layout artifacts, namely custom headers and footers, which require higher graph API permissions. Removing these nodes from the XML file is the fastest workaround if they are not strictly necessary for your site deployment.
Locate the SiteTemplate.xml file that you extracted and open it using a standard text editor or a code editor like Visual Studio Code.
Use the search function (Ctrl+F) to find the XML tags related to the site header and footer. These are typically found within the layout or theme sections of the provisioning template.
Carefully highlight the entire block for the header and footer configurations and either delete them or wrap them in XML comments (<!-- ... -->).
Save the changes to your SiteTemplate.xml file. Open your PowerShell console and run the Invoke-PnPSiteTemplate command again to apply the modified template to your target site.

Looking for a Lightweight Alternative to Microsoft Office?
While troubleshooting complex Microsoft environments, you need a fast and reliable productivity suite. WPS Office offers a free, highly compatible alternative to Microsoft Office, letting you handle Word, Excel, and PowerPoint files effortlessly.
- 1. Visit the WPS Office website: Go to the official WPS Office website to find the free download link.
- 2. Download the software: Click the download button to get the lightweight installation package for your operating system.
- 3. Install and start working: Run the installer, follow the on-screen instructions, and launch WPS Office to open your Microsoft documents instantly.

Frequently Asked Questions
Why does my PnP provisioning template require an access token?
Certain modern site components, such as customized headers and footers, require Microsoft Graph API permissions to be configured. If the PnP Management Shell lacks consent for these permissions, PowerShell prompts for an access token.
How do I fix the access token error without removing the header and footer?
A Microsoft 365 Global Administrator can resolve this by granting tenant-wide admin consent to the PnP Management Shell Azure AD enterprise application, allowing it to provision those specific layout components.
Where should I report bugs regarding PnP PowerShell templates?
You can report unexpected behavior, request new features, and find workarounds by visiting the official PnP PowerShell repository on GitHub and opening a ticket under the 'Issues' section.




