Using Office Dev PnP Apply-SPOProvisioningTemplate command inside Azure Automation Scripting

Bronze Contributor

On my PC using Windows PowerShell I was able to Provisioning a SharePoint Online site using the Office Dev PnP Apply-SPOProvisioningTemplate command, providing the -Path C:\mylocalfolder\myFile.pnp parameter.

 

Using Azure Automation I am also able to Provisioning a SharePoint Online site using the Office Dev PnP Apply-SPOProvisioningTemplate command. This works when I provide the -Path parameter and reference to a location inside the same sitecollection, e.g. -Path https://mytentant.sharepoint.com/sites/SiteCollectionToBeChange/siteassets/myFile.pnp parameter. So this works:

  1. Create the sitecollection
  2. Upload the myFile.pnp file to the SiteAssets document library
  3. Apply the provisioning template using Apply-SPOProvisioningTemplate  -Path https://mytentant.sharepoint.com/sites/SiteCollectionToBeChange/siteassets/myFile.pnp parameter.

 

But what I want is to apply the provisioning template using Apply-SPOProvisioningTemplate -Path paramter referencing one central .PNP file that I reuse for each site I deploy, e.g. using the -Path https://mytentant.sharepoint.com/sites/SiteCollectionWithAssets/siteassets/myFile.pnp parameter. The myFile.pnp file referenced is stored inside a central location that I use for each site I provision. But this doesn't seem to work.

 

I would prefer to still use the Apply-SPOProvisioningTemplate command, described at https://github.com/OfficeDev/PnP-PowerShell/blob/master/Documentation/ApplySPOProvisioningTemplate.m..., but also inside Azure Automation.

 

Any idea how to provision a site to a just created site collection with Azure Automation PowerShell scripting, without having to manually upload the .PNP file to the same site to be provisioned? 

0 Replies