PnP-PowerShell icon indicating copy to clipboard operation
PnP-PowerShell copied to clipboard

New-PnpWeb - unauthorised error?

Open LateNightDBA opened this issue 9 years ago • 2 comments

###Notice: many issues / bugs reported are actually related to the PnP Core Library which is used behind the scenes. Consider carefully where to report an issue:###

  1. Are you using Apply-SPOProvisioningTemplate or Get-SPOProvisioningTemplate? The issue is most likely related to the Provisioning Engine. The Provisioning engine is not located in the PowerShell repo. Please report the issue here: https://github.com/officedev/PnP-Sites-Core/issues.
  2. Is the issue related to the cmdlet itself, its parameters, the syntax, or do you suspect it is the code of the cmdlet that is causing the issue? Then please continue reporting the issue in this repo.
  3. If you think that the functionality might be related to the underlying libraries that the cmdlet is calling (We realize that that might be difficult to determine), please first double check the code of the cmdlet, which can be found here: https://github.com/OfficeDev/PnP-PowerShell/tree/master/Commands. If related to the cmdlet, continue reporting the issue here, otherwise report the issue at https://github.com/officedev/PnP-Sites-Core/issues

Reporting an Issue or Missing Feature

Please confirm what it is that your reporting Unexpected errors from New-PnpWeb

Expected behavior

Please describe what output you expect to see from PnP-PowerShell Cmdlets No errors as I am the site owner/administrator - SharePoint online

Actual behavior

Please describe what you see instead. Please provide samples of HTML output or screenshots Returns following error, though sub site is successfully created.

New-PnpWeb : Access denied. You do not have permission to perform this action or access this resource. At line:9 char:1

  • New-PnpWeb @params;
  •   + CategoryInfo          : WriteError: (:) [New-PnPWeb], ServerUnauthorizedAccessException
      + FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.NewWeb
    
    
    

Steps to reproduce behavior

Please include complete code samples in-line or linked from gists $params = @{ 'Title' = 'My Test Site'; 'Description' = 'Test home site for local team collabration'; 'Url'= 'TEST'; 'Locale'=1033; 'Template'='STS#0'; 'InheritNavigation'=$true } New-PnpWeb @params;

Which version of the PnP-PowerShell Cmdlets are you using?

  • [ ] PnP PowerShell for SharePoint 2013
  • [ ] PnP PowerShell for SharePoint 2016
  • [ X] PnP PowerShell for SharePoint Online

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

(you can retrieve this by executing Get-Module -Name *pnppowershell* -ListAvailable) 2.11.17...

How did you install the PnP-PowerShell Cmdlets?

  • [ ] MSI Installed downloaded from GitHub
  • [ X] Installed through the PowerShell Gallery with Install-Module
  • [ ] Other means

LateNightDBA avatar Feb 07 '17 08:02 LateNightDBA

We are running in to this same issue. Site gets created, but we get an unauthorized error in PS. Did you ever find a solution to this?

superarash avatar Nov 28 '17 21:11 superarash

Just got the same issue! The site is created, but there is an error. I bypass it by adding the -ErrorAction Continue switch to my script, but it makes it less robust.

umaknow-francis avatar Oct 04 '18 15:10 umaknow-francis