Forum Discussion
RobD365
Aug 29, 2022Brass Contributor
Setting permissions via PnPSiteTemplate
Hi All,
I'm trying to create a site template for use on sub-webs via Get-PnPSiteTemplate / Invoke-PnPSiteTemplate which will configure create site-specific groups, and set permissions on one of the libraries it creates.
Looking at the XML generated from Get-PnPSiteTemplate, I can see
<pnp:Security AssociatedOwnerGroup="{groupsitetitle} Owners" AssociatedMemberGroup="{groupsitetitle} Members" AssociatedVisitorGroup="{groupsitetitle} Visitors">, nested in there are pnp:SiteGroup line items for the site collection level groups, and {groupsitename} Owners/Members/Visitors as well as a {groupsitename} Custom group.
When I Invoke-PnPSiteTemplate, the libraries and home page are generated correctly, however the groups are missing - the only permissions are those inherited from the site collection.
Any help would be appreciated.
Cheers
Rob
- RobD365Brass Contributor
Some progress ...
I've managed to get the "Associated groups" created by replacing the `groupsitetitle` variable with `groupsitename`, so now looking at /sites/ParentSite/SubSite/_layouts/15/user.aspx, I see the groups specific to the sub site, and not the groups from the parent, however clicking the Settings Cog, and looking at permissions there it shows the site collection members - if i manually create a sub site, it shows the members specific to the sub-site.