pnp / PnP-PowerShell

SharePoint PnP PowerShell CmdLets
https://pnp.github.io/powershell
Other
990 stars 663 forks source link

Apply-PnPProvisioningTemplate - "Access Denied" at the end, even when template is "empty" #1842

Open SpeedmaxX opened 5 years ago

SpeedmaxX commented 5 years ago

Reporting an Issue or Missing Feature

I'd like to copy a SiteCollection on O365 to another new O365 SiteCollection. When applying the template, I always get an access denied-message at the end of processing. `Apply-PnPProvisioningTemplate : Zugriff verweigert. Sie haben keine Berechtigung, diesen Vorgang auszuführen oder auf diese Ressource zuzugreifen. In C:\Users\mgev\Documents\git\O365 - CopyProjectSite\testdrive.ps1:100 Zeichen:9 Apply-PnPProvisioningTemplate -Path .\YourSiteTemplate.xml -C ...


     CategoryInfo          : WriteError: (:) [Apply-PnPProvisioningTemplate], ServerUnauthorizedAccessException
     FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Provisioning.ApplyProvisioningTemplate`

or in English:
`Apply-PnPProvisioningTemplate : Access denied. You do not have permission to perform this action or access this resource`

I have already stripped down the template, so that nothing is transported and the template is empty
`<?xml version="1.0"?>
<pnp:Provisioning xmlns:pnp="http://schemas.dev.office.com/PnP/2018/05/ProvisioningSchema">
  <pnp:Preferences Generator="OfficeDevPnP.Core, Version=3.0.1808.0, Culture=neutral, PublicKeyToken=5e633289e95c321a" />
  <pnp:Templates ID="CONTAINER-TEMPLATE-D9F8BE053A444BA8AD3DA269FEE0D5F0">
    <pnp:ProvisioningTemplate ID="TEMPLATE-D9F8BE053A444BA8AD3DA269FEE0D5F0" Version="1" BaseSiteTemplate="GROUP#0" Scope="RootSite" />
  </pnp:Templates>
</pnp:Provisioning>`

even in this case, the message occurres. 

### Expected behavior 
The cmdlet should report a more "descriptive" error - or better: should fully work

### Actual behavior 
see above; I was also tenant- and SiteCollection-administrator when running the code

### Steps to reproduce behavior
https://gist.github.com/SpeedmaxX/dbebb9261a3461375feeb6f5ff8e87a7

### Which version of the PnP-PowerShell Cmdlets are you using?
- [ ] PnP PowerShell for SharePoint 2013
- [x ] PnP PowerShell for SharePoint 2016
- [ ] PnP PowerShell for SharePoint Online

### What is the version of the Cmdlet module you are running?
3.0.1808.1

### How did you install the PnP-PowerShell Cmdlets? 
- [ ] MSI Installed downloaded from GitHub
- [X ] Installed through the PowerShell Gallery with Install-Module
- [ ] Other means
BorAndre commented 5 years ago

Hi SpeedmaxX. Did you found any solution? I have the same problem.

strausmann commented 4 years ago

Hello everybody, you need to Disable the "DenyAddAndCustomizePages"

Set-SPOSite https://tenant.sharepoint.com/sites/communication -DenyAddAndCustomizePages $false