Lab · Beginner · 20 min
Register an app for PnP PowerShell and connect
Since September 2024 PnP PowerShell no longer ships a shared multi-tenant app. You register your own app once per tenant and use its client ID every time you connect.
What you need
- A test tenant where you are Global Administrator or Application Administrator
- PowerShell 7.4 or later
- PnP.PowerShell module
Steps
- Install the module
Install PnP PowerShell for your user.
PowerShell Install-Module PnP.PowerShell -Scope CurrentUser - Register the app
Creates an Entra app with delegated permissions for SharePoint and Graph and opens a consent prompt.
PowerShell Register-PnPEntraIDAppForInteractiveLogin -ApplicationName "PnP PowerShell" -Tenant <tenant>.onmicrosoft.com -Interactive - Note the client ID
The command prints the app (client) ID. Store it in your profile or a team wiki page.
- Connect
Connect to the admin site with the new client ID.
PowerShell Connect-PnPOnline -Url https://<tenant>-admin.sharepoint.com -Interactive -ClientId <client-id> - Validate
List a few sites to prove the connection works.
PowerShell Get-PnPTenantSite | Select-Object -First 5 Url, Template
Check your result
Get-PnPTenantSite returns sites without an access error.
InnovaticT