If like me, you use PowerShell or Scripts of any kind, sometimes you find things don’t work, and then you find those commands that resolve it. Isn’t it true that down the line, when you hit the same issue, you then can’t remember what you did. Well, this post is a reminder for me.
PnP PowerShell Login from Window, Ensuring Cached Authentication Tokens are Cleared
$url = "https://[tenant].sharepoint.com"
Connect-PnPOnline -Url $url -SPOManagementShell -ClearTokenCache
PnP PowerShell Ensure the Correct Permissions are Assigned to the PnP Management Shell Application
# Remove the SharePoint Online PnP Module (close any current PowerShell Windows)
Remove-Module -Name SharePointPnPPowerShellOnline
# Install a specific PnP Version
Install-Module -Name SharePointPnPPowerShellOnline -MinimumVersion 3.26.2010.0
# Register the correct PnP PowerShell Peermissions
$url = "https://[tenant].sharepoint.com"
Register-PnPManagementShellAccess -SiteUrl $url