question

YiruChen-1261 avatar image
0 Votes"
YiruChen-1261 asked MichaelHan-MSFT answered

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

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

SharePoint Admin? or Global Admin?

office-sharepoint-online
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

trevorseward avatar image
0 Votes"
trevorseward answered

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.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

michev avatar image
0 Votes"
michev answered sumithakurien-3618 commented

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

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

to do this:

102978-image.png


0 Votes 0 ·
image.png (2.6 KiB)
MichaelHan-MSFT avatar image
0 Votes"
MichaelHan-MSFT answered

Hi @YiruChen-1261,

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.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.