Using Windows Credential Manager with PnP PowerShell
If you are managing multiple site collections in single Office 365 tenant or multiple Office 365 tenants, then getting a prompt for credentials every time you would like to connect to SharePoint Online is a bit annoying and also slows down you a bit. If you are using the script, you could hardcode the credentials in your PowerShell script. However, this is not secure and is not the recommended way.
The PnP PowerShell module supports Windows Credential Manager, which helps you securely manage and use the credentials in scripts and PowerShell sessions.
To use the Windows Credential Manager, use the following steps:
- Open
Control Panel
. - Select
Credential Manager
:
- Select
Add a generic credential
:
- There are two approaches available:
- URL-based approach:
Internet or network address
--enter the URL of the site you would like to set up the credentials for. Enter the username and password in theUser name
andPassword
fields:
- URL-based approach:
The following command depicts...