SharePoint / sp-provisioning-service

Code for the Microsoft Look Book and provisioning service
https://lookbook.microsoft.com
MIT License
99 stars 42 forks source link

Access denied error while deploying template #704

Closed WellvanaIT closed 5 months ago

WellvanaIT commented 6 months ago

Describe the issue We are trying to deploy a new lookbook template on multiple SharePoint sites. We have already installed the module and connected with the sharepoint but when try to give the invoke command we get error of "Access Denied".

Expected behavior We expect that the template "the landing" gets deployed on the site "Wellvana IT"

Screenshots Attached* MicrosoftTeams-image (76)

Details (please complete the following information):

Additional context Add any other context about the problem here.

AliRaeis commented 5 months ago

I am also getting the same issue for this template.

PaoloPia commented 5 months ago

Hi, you are targeting the wrong site. You should not connect to the admin site (the one with URL https://tenant-admin.sharepoint.com/). Instead, you should connect to a regular site that you need to create before applying the template. In your scenario, you should create a Communication Site.

AliRaeis commented 5 months ago

If I try not using the SP admin site (which is stated to use here https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/applying-pnp-templates) then I receive an error Invoke-PnPSiteTemplate: Object reference not set to an instance of an object. Anything else to try?

PaoloPia commented 4 months ago

Hi @AliRaeis, I'm sorry but I made a mistake while writing the document that you are referring to. Good catch, thanks! I already fixed the issue and it should become available soon on learn.microsoft.com. Meanwhile, please target the URL of the site when connecting, using a command like:

Connect-PnPOnline https://<tenant>.sharepoint.com/sites/<URL-of-your-target-site> -Interactive

If you do that, it should work as expected. Remember to create the site before connecting to it and before running the Invoke-PnPSiteTemplate command.

Thanks.

AliRaeis commented 4 months ago

Thank you for clarifying, I can confirm that this has now worked.