Quick Authentication From PnP PowerShell To Access SharePoint

Ahamed Fazil Buhari
 
Senior Developer
February 13, 2019
 
Rate this article
 
Views
3485

 

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

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

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

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

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

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

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

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.

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

 

Category : Office 365, SharePoint

Author Info

Ahamed Fazil Buhari
 
Senior Developer
 
Rate this article
 
Ahamed is a Senior Developer and he has very good experience in the field of Microsoft Technologies, especially SharePoint, Azure, M365, SPFx, .NET and client side scripting - JavaScript, TypeScript, ...read more
 

Leave a comment