
Hi there, SharePoint enthusiasts! I want to share the manual on how to correctly configure the PnP.PowerShell
app in Entra ID.
PowerShell 7 is required for compatibility with the latest PnP.PowerShell module. If PowerShell 7 is not installed, you can install it using the Windows Package Manager (winget):
winget install --id Microsoft.PowerShell --source winget
💡 Note: After installation, close any existing PowerShell windows and launch PowerShell 7 from the Start menu.
Launch PowerShell 7 and run:
Install-Module PnP.PowerShell -AllowClobber -Scope CurrentUser
When prompted:
Create a new Azure App registration with the following command:
Register-PnPEntraIDAppForInteractiveLogin -ApplicationName "PnP.PowerShell v2" -Tenant yourtenant.onmicrosoft.com
💡 Important: Replace
yourtenant.onmicrosoft.com
with your actual tenant domain.
The app registration will request the following permissions:
After successful registration, PowerShell will display your Application (Client) ID:
Azure App ID: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
Important: Save this ID in a secure location. You’ll need it for all future connections.
Verify your setup by connecting to SharePoint Online:
# Store your App ID in a variable$AzureAppId = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"# Connect to SharePoint OnlineConnect-PnPOnline https://yourtenant.sharepoint.com -Interactive -ClientId $AzureAppId# Test the connectionGet-PnPSite
Replace:
XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
with your actual Azure App IDyourtenant
with your tenant nameGrant-PnPAzureADAppSitePermission -AppId "XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" -DisplayName "App Name" -Permissions FullControl -Site https://[Tenant].sharepoint.com/sites/SITE_URL