Setting up an App-only principal in SharePoint Online is documented in Grant Access using SharePoint App-Only This post highlights how this approach can resolve: “Unauthorized (401) errors”, running tenant level PnPComandlets such as Set-PnPStorageEntity , under an global admin account with multi-factor authorisation (MFA) enforced.
[Read more…] about Set Up App-Only Access To Your Tenant to solve (401) Unathorized Errors