The Provisioning Template URI HumaxTemplate1.xml

Not applicable

We connect to our customer tenant and get a .pnp file without errors:



$tenant = "ourcustomertenant";
$sourceSite = "/sites/ClientesNotaCredito";
$webUrl = "https://{0}{1}/" -f $tenant, $sourceSite;
$path = "C:\Templates\HumaxTemplate.pnp"
Write-Output $("Connecting to {0}..." -f $webUrl);
Connect-PnPOnline -Url $webUrl -Credentials WCMStoredCredentials;
Write-Output "Context obtained";
Write-Output "Creating PnP template...";
Get-PnPProvisioningTemplate -Out $path 
Write-Output $("Template saved to {0}" –f $path);

Then we connect to our tenant, to replicate the environment, and we created a site collection with the same publishing template and execute this:



# Define variables
$tenant = "ourowntenant";
$targetSite = "/sites/DevHumax";
$path = "C:\Templates\HumaxTemplate1.pnp";
$siteTitle = "My Target Site";
$siteDescription = " ";
$siteUrl = "";

# Get context
$webUrl = "https://{0}{1}" -f $tenant, $targetSite;
Write-Output $("Connecting to {0}..." -f $webUrl);
Connect-SPOnline -Url $webUrl -Credentials WCMStoredCredentials;
Write-Output "Done";

# Create new subsite
$web = Get-PnPWeb -Identity /sites/DevHumax
# New-SPOWeb -Title "$siteTitle" -Url "$siteUrl" -Description "$siteDescription" -Locale 1043 -Template "STS#1"

# Apply template
Write-Output $("Applying PnP template [{0}] to site [{1} ({2})]..." -f $path, $web.Title, $web.Url);
Apply-PnPProvisioningTemplate $path;
Write-Output "Done";



However we get this error:


Apply-PnPProvisioningTemplate : The Provisioning Template URI HumaxTemplate1.xml is not valid.
At line:2 char:1
+ Apply-PnPProvisioningTemplate $path;
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (:) [Apply-PnPProvisioningTemplate], ApplicationException
    + FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Provisioning.ApplyProvisioningTemplate
3 Replies

Did you find a solution? I have the same error.

I am also facing the same error, did you find any solution?

I had the same problem... I think the problem was you changed the filename of the pnp-template. You created a template as humaxtemplate.pnp, then I guess you changed the pnp-File to humaxtemplate1.pnp, then the applying-process fails.