Invoke-PnPTenantTemplate is not performing any action.. "Access token acquired"

john john Pter 340 Reputation points
2024-07-17T18:01:50.68+00:00

I have 2 SharePoint Online tenants which both have a modern communication sites. now i used this command to get the source site template:-

PS C:\Users\mohan> Connect-PnPOnline -Url "https://ssms.sharepoint.com/sites/PPM-test/" -Interactive

PS C:\Users\mohan> Get-PnPSiteTemplate -Out "PnP-Provisioning-F.xml"

and i got this file:-

image

but when i try to apply the site template to the destination site using this command:-

PS C:\Users\mohan> Connect-PnPOnline -Url "https://destination.sharepoint.com/sites/PPM-test/" -Interactive

PS C:\Users\mohan> Invoke-PnPTenantTemplate -Path "PnP-Provisioning-F.xml"

the command show the following text:-

"initializing engine....Applying Template... "

then it ends after 2 seconds, without applying any thing to the destination.. so what can be causing this issue?

Also when i run the Invoke-PnPTenantTemplate using -Verbose, i got this error Access token acquired:-

349621839-e2426785-caaf-4a6e-91be-e5ae5509cb44

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,816 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,549 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,583 questions
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 36,171 Reputation points Microsoft Vendor
    2024-07-18T01:33:55.7166667+00:00

    Hi @john john Pter,

    1.Verify PnP PowerShell Module Versions:

    Ensure you are using the latest version of the PnP PowerShell module. Older versions might have bugs or missing features.

    Update-Module -Name PnP.PowerShell
    

    2.Check for Errors in Verbose Mode.

    Run the Invoke-PnPTenantTemplate command with the -Verbose flag to get more detailed output. This can help identify any specific errors.

    Invoke-PnPTenantTemplate -Path "PnP-Provisioning-F.xml" -Verbose
    

    3.Inspect Access Token and Permissions:

    Ensure that the user account you are using has the necessary permissions to apply the template on the destination site. The error message mentioning the access token suggests there might be a permissions issue.

    Verify that the account has at least Site Collection Administrator rights on the destination site.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.