locked
SharePointPnPPowerShellOnline RRS feed

  • Question

  • HI,

    I have site collection admin rights for one of the SharePoint Online sites and not  SharePoint Admin at tenant level.

    Site collection admins can run SharePointPnPPowerShellOnline commands pertaining to a specific site.

    I can connect to the site using Connect-PnPOnline cmdlet.

    However I get below error while I run Set-PnPSite cmdlet.(irrespective of using -UseWebLogin while connecting)

    "The remote server returned an error: (401) Unauthorized"

    Going with powershell because site policy also throws unexpected error.

    Regards,

    Prajakta


    Thursday, July 23, 2020 8:11 AM

All replies

  • It should be a SharePoint admin to run this command.

    Justin Liu Office Apps & Services MVP, MCSE
    Senior Software Engineer
    Learn Microsoft 365 from Microsoft DOCs now!
    Please Vote and Mark as Answer if it helps you.

    Friday, July 24, 2020 12:54 AM
  • Hi Prajakta,

    First, please open SharePoint Online Management Shell or Windows PowerShell as Administrator and then execute the cmdlets.

    Second, you will need higher privilege than site collection administrator to complete running “Set-PnPSite” and the actions followed.

    Contact the tenant administrator and assign at least “SharePoint admin” role to the account you are using. Please note that it might take a while for the change to take effect before you run the commands.

    ---

    This “Microsoft Online: SharePoint Online” Forum will be migrating to a new home on Microsoft Q&A, please refer to this sticky post for more details.

    Best regards,

    Chelsea Wu


    "SharePoint" forums will be migrating to a new home on Microsoft Q&A !
    We invite you to post new questions in the "SharePoint" forums' new home on Microsoft Q&A !

    Friday, July 24, 2020 2:12 AM
  • OK Thanks. But Site collection admins should be allowed to run this command since this will be applied to a particular site collection.

    Is there any other way to make a sharepoint online site collection read only with only site collection admin rights.

    Site Policy link is also inaccessible.

    Friday, July 24, 2020 8:20 AM
  • OK Thanks. But Site collection admins should be allowed to run this command since this will be applied to a particular site collection.

    Is there any other way to make a sharepoint online site collection read only with only site collection admin rights.

    Site Policy link is also inaccessible.

    Friday, July 24, 2020 8:21 AM
  • Hi Prajakta,

    I’m afraid using the Site Policies button under Site Settings would be the only solution as a site collection administrator. Higher privilege at tenant level is needed to run PowerShell cmdlets due to security consideration.

    ---

    This “Microsoft Online: SharePoint Online” Forum will be migrating to a new home on Microsoft Q&A, please refer to this sticky post for more details.

    Best regards,

    Chelsea Wu


    "SharePoint" forums will be migrating to a new home on Microsoft Q&A !
    We invite you to post new questions in the "SharePoint" forums' new home on Microsoft Q&A !

    Friday, July 24, 2020 8:52 AM
  • Clicking on site policies button throws 'unexpected error'
    Friday, July 24, 2020 9:12 AM
  • Hi Prajakta,

    What type is the site you are trying to use this feature?

    Please make sure the “Site Policy” feature is activated via Site Settings > Site Collection Features. If its has already been activated, turn it off and then reopen again.

    ---

    This “Microsoft Online: SharePoint Online” Forum will be migrating to a new home on Microsoft Q&A, please refer to this sticky post for more details.

    Best regards,

    Chelsea Wu


    "SharePoint" forums will be migrating to a new home on Microsoft Q&A !
    We invite you to post new questions in the "SharePoint" forums' new home on Microsoft Q&A !

    Friday, July 24, 2020 9:31 AM
  • Hi,

    Do you have any progress on this thread?

    Please feel free to let us know if you need further assistance.

    Best regards,

    Chelsea Wu


    "SharePoint" forums will be migrating to a new home on Microsoft Q&A !
    We invite you to post new questions in the "SharePoint" forums' new home on Microsoft Q&A !

    Monday, July 27, 2020 6:19 AM
  • I tried above. Still no luck. Feature is activated. Its a classic site.
    Monday, July 27, 2020 1:02 PM
  • Hi Prajakta,

    Consider using an account with higher privilege (SharePoint admin/Global admin) and confirm if this feature is not available in this site at all.

    Still, using PowerShell to set this site to Read Only would be the best solution.

    Best regards,

    Chelsea Wu


    "SharePoint" forums will be migrating to a new home on Microsoft Q&A !
    We invite you to post new questions in the "SharePoint" forums' new home on Microsoft Q&A !

    Tuesday, July 28, 2020 1:25 AM
  • Hi,

    This forum will be locked down, if you need further assistance with this issue, you can continue to post in here before 8/10/2020. It is recommended to create a new question on Microsoft Q&A, we will continue to support you on the new home.

    Thank you for your understanding.

    Best regards,

    Chelsea Wu

    "SharePoint" forums will be migrating to a new home on Microsoft Q&A !
    We invite you to post new questions in the "SharePoint" forums' new home on Microsoft Q&A !

    Tuesday, August 4, 2020 2:27 AM