Hope you guys are doing best, Actually I have issue on implementing Root Site template on Subsites of SharePoint with Azure using PnP PowerShell Script. After lot of search on web I tried to implement with Azure storage account and with Azure functions. I have also change "Scope='Web'" in template.xml file but template is not applying anymore, also there is no error but function runs successfully. I am providing Code here please have a look and help me. Thanks in advance.
With Azure Automation
Connect-PnPOnline -ClientId "**********" -ClientSecret "***********" -Url "https://Contoso.sharepoint.com/sites/TargetComSite/agreement_47" Get-PnPProvisioningTemplate -Out template.pnp -IncludeAllClientSidePages -PersistBrandingFiles
Connect-PnPOnline -ClientId "**********" -ClientSecret "***********" -Url "https://Contoso.sharepoint.com/sites/TargetComSite/agreement_49" Apply-PnPProvisioningTemplate -Path .\template.pnp
With Azure Function
param($Request, $TriggerMetadata)
#$requestBody = Get-Content $Request -Raw | ConvertFrom-Json
$path = "C:\home" $env:PSModulePath += ";$path\Modules\SharePointPnPPowerShellOnline" Write-Output "Running PnP version:" (Get-Module -Name SharePointPnPPowerShellOnline -ListAvailable).Version
Connect-PnPOnline -AppId "#####" -AppSecret "***************" -Url https://Contoso.sharepoint.com/sites/TargetComSite/agreement_49
Apply-PnPProvisioningTemplate -Path C:\home\site\wwwroot\ApplyPnPProvisioningTemplate\template.xml -ClearNavigation