what role is required to run Powershelll command in SharePoint Online?

Yiru Chen 681 Reputation points
2021-06-07T16:55:34.18+00:00

What role is required to be able to run Poweshell script in SharePoint online?

SharePoint Admin? or Global Admin?

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,682 questions
0 comments No comments
{count} votes

Accepted answer
  1. Trevor Seward 11,681 Reputation points
    2021-06-08T01:10:19.027+00:00

    The SPO cmdlets require the SharePoint Admin role (or Global Admin). PnP cmdlets require permission based on the scope of the cmdlet; this could be as little as Read or Member access to a particular site. Some PnP cmdlets require the SPO Admin role, but those are the PnP tenant cmdlets.

    You should use https://www.powershellgallery.com/packages/PnP.PowerShell as the other module you listed is no longer under development.

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Vasil Michev 95,666 Reputation points MVP
    2021-06-07T18:05:20.367+00:00

    Which cmdlet in particular? Generally speaking you need to be a SPO admin, some functionality might require a different role though.


  2. MichaelHan-MSFT 18,016 Reputation points
    2021-06-08T01:49:28.123+00:00

    Hi @Yiru Chen ,

    The cmdlet Install-Module SharePointPnPPowerShellOnline need to be ran as a local administrator to install the PnP PowerShell module.

    After installing the PnP PowerShell module, as trevor said, PnP cmdlets require permission based on the scope of the cmdlet.

    Usually, you could use site member account to access your site with the cmdlet: Connect-PnPOnline -Url https://tenant.sharepoint.com/sites/test


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments