provision-assist-m365 icon indicating copy to clipboard operation
provision-assist-m365 copied to clipboard

Error when creating sharepoint objects

Open jb-365 opened this issue 3 months ago • 0 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:

  1. Check for keyvaultname
  2. Create sharepointsite
  3. 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

  1. 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).
  2. The account used has the following roles: Global admin, sharepoint admin, teams admin, subscription owner.
  3. The account used has the following permissions on the sharepoint site: site owner, owner, site admin
  4. The sharepoint site is placed under /sites
  5. 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 avatar Mar 19 '24 12:03 jb-365