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

  1. Install the module

    Install PnP PowerShell for your user.

    PowerShell
    Install-Module PnP.PowerShell -Scope CurrentUser
  2. 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
  3. Note the client ID

    The command prints the app (client) ID. Store it in your profile or a team wiki page.

  4. Connect

    Connect to the admin site with the new client ID.

    PowerShell
    Connect-PnPOnline -Url https://<tenant>-admin.sharepoint.com -Interactive -ClientId <client-id>
  5. 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.

Microsoft documentation

Disclaimer. These samples are provided as is, without warranty of any kind. Read and test every script in a non-production tenant before you run it, and run reports before any command that changes or deletes data.