Quick Authentication from PnP PowerShell to access SharePoint


Ahamed Fazil Buhari
Senior Developer
Published On :   13 Feb 2019
Visit Count
Today :  4    Total :   248


Hello everyone,

In this article we will see how to easily access SharePoint from PnP PowerShell by quick authentication (no need to provide username and password each time). This could help when there’s a need to run a scheduled task which access SharePoint. The first and foremost step to access SharePoint from PnP PowerShell is authentication. If we set this authentication default from your windows machine then we no need to provide username and password each time.

I’ve already published couple of articles on PnP PowerShell to setup your environment, please refer those if you are looking for initial setup

· How to Use PnP PowerShell in Windows 7 or Windows 8 Machine

· How to Connect to SharePoint Online Using PnP PowerShell and SharePoint Online Management Shell

Step 1: After successful setup, open Windows PowerShell

clip_image002

And I am going to access below SharePoint site through PnP PowerShell

clip_image004

Step 2: Using PnP command, I am accessing my SharePoint site as shown below, to know more about PnP commands visit here

clip_image006

As you can see, Windows PowerShell prompts and request for username & password. After providing right username & password we can have access to the SharePoint site. For testing, I just gave Get-PnPUser cmd

clip_image008

Step 3: In order to avoid this credential prompt, we can make use Credential Manager,

clip_image009

Step 4: In Credential Manager Window, click on “Add a generic credential

clip_image011

Step 5: Provide SharePoint site url (if you want only particular site collection, then specify the site name explicitly), credentials and click on OK

clip_image013

Step 6: Now I opened the new PowerShell window as shown in Step 1. And connected to my SharePoint site successfully without prompting for credential.

clip_image015

In this way we can run scheduled task or quickly access SharePoint site by avoiding giving credentials every time. I hope you enjoyed the article, thank you for reading.

Happy Coding

Ahamed

Categories