Error when creating sharepoint objects
jb-365 opened this issue · 1 comments
Description
When I run the .deploy.ps the script encounters the following error:
powershell.exe Error: 0 : 2024-03-12 11:41:46.9536 [PnP.Framework] [0] [Error] ExecuteQuery threw following exception: Microsoft.SharePoint.Client.ServerUnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
This is the command which is failing: Invoke-PnPSiteTemplate -Path (Join-Path $packageRootPath $templatePath) -ClearNavigation (Line 319)
The script succeeds doing the following things:
- Check for keyvaultname
- Create sharepointsite
- Login to AZ, azureAD, sharepointPNP, Microsoft graph
We also tried running the script using the serviceaccount specificed in the json parameter file for the sharepoint PNP login part of the script. (since this is the account which is specified in the json parameter file). We encountered the same results with this account.
Steps to reproduce
- Create the application using createazureadapp.ps1 (We changed the scope of the application to internal/this tenant only, since the intended user audience is internal members of our tenant).
- The account used has the following roles: Global admin, sharepoint admin, teams admin, subscription owner.
- The account used has the following permissions on the sharepoint site: site owner, owner, site admin
- The sharepoint site is placed under /sites
- These powershell modules are being used:
1.12.0 PnP.PowerShell
1.2.2.1 WriteAscii
5.8.0 MicrosoftTeams
7.8.4 ImportExcel
2.11.0 Microsoft.Graph
11.3.1 Az
2.0.2.183 AzureADPreview
Expected results
The deploy script does not complete. Stuck on create sharepoint items.
Actual Results
Error message described above.
Solution component
Deployment Script
Operating system (environment)
Windows
Additional Info
No response
@jb-365 I appreciate some time has passed since you raised this issue. We've now moved the deployment script over to PowerShell 7 and removed a lot of module dependencies so if you try again with the latest release, this should now be sorted. Thanks