Hi there, SharePoint enthusiasts! I want to share the manual on how to correctly configure the PnP.PowerShell app in Entra ID.
Global Administrator access to your Microsoft 365 tenant Windows 10/11 operating system 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):
powershell 📋 Copy
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:
powershell 📋 Copy
Install-Module PnP . PowerShell - AllowClobber - Scope CurrentUser
When prompted:
Select [Y] Yes to install from PSGallery Wait for the installation to complete Create a new Azure App registration with the following command:
powershell 📋 Copy
Register-PnPEntraIDAppForInteractiveLogin - ApplicationName "PnP.PowerShell v2" - Tenant yourtenant . onmicrosoft . com
💡 Important: Replace yourtenant.onmicrosoft.com with your actual tenant domain.
A browser window will open automatically Sign in with your Global Administrator account Review the requested permissions Click Accept to grant consent for your organization Permissions Granted The app registration will request the following permissions:
User.Read - Sign in and read user profileSites.FullControl.All - Full control of all site collectionsGroup.ReadWrite.All - Read and write all groupsTermStore.ReadWrite.All - Read and write term store data
Permissions granted
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:
powershell 📋 Copy
$AzureAppId = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
Connect-PnPOnline https: / / yourtenant . sharepoint . com - Interactive - ClientId $AzureAppId
Get-PnPSite
Replace:
XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX with your actual Azure App IDyourtenant with your tenant namePowerShell 📋 Copy
Grant-PnPAzureADAppSitePermission -AppId "XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" -DisplayName "App Name" -Permissions FullControl -Site https://[Tenant].sharepoint.com/sites/SITE_URL
Read more about Grant-PnPAzureADAppSitePermission