I want to transfer a small SharePoint Site to a different tenant with PnP.

I log in with the following command:

Connect-PnPOnline -url https://mytenant.sharepoint.com/sites/mysite -UseWebLogin

When exporting the site template, I get an error when I include (don't exclude) lists.

Get-PnpSiteTemplate -Out TemplateExport.xml
>> Get-PnPSiteTemplate : GetAccessTokenAsync() called without an ACS token generator. 
   Specify in AuthenticationManager constructor the authentication parameters

If I exclude lists, the export works fine (no error).

Get-PnpSiteTemplate -Out TemplateExport.xml -excludeHandlers Lists

If I export only lists by themselves, I don't get an error either.

Export-PnPListToSiteTemplate -List "MyList" -Out ListTemplateExport.xml

Why does the list template export work by itself, but the site template export fails with the lists?

Can I find out which part of the list export fails?

2 Answers 2


The solution is to disable MFA for a user and connect without the "-UseWebLogin" flag.

Then Get-PnPSiteTemplate command worked without any issues.


You could try the following PowerShell commands:

#Config Variables
$SiteURL = "https://xxx.sharepoint.com/"
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)
#Get the Context & Web Objects
$ClientContext = Get-PnPContext
$Web = Get-PnPWeb
#Get All Web Templates
$WebTemplateCollection = $Web.GetAvailableWebTemplates(1033,0)
#Get the Template Name and Title
$WebTemplateCollection | Select Name, Title

For Reference: Get Site Templates in SharePoint Online using PowerShell

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.