Forum Discussion
RichardS
Aug 10, 2021Copper Contributor
Get-PnPSiteTemplate : Attempted to perform an unauthorized operation and ACS token missing
I am trying to export a design template for a site that I am in the Owners group for, and I have Share Point Administrator role activated. I am running the Powershell ISE as ADMIN When I run th...
Aug 10, 2021
I would suggest that you try using the new version of PnP PowerShell within PowerShell core: https://pnp.github.io/powershell/articles/installation.html
When you connect using -UseWebLogin, you get an ACS generated token, which will not work for things like exporting the site headed and footer as it won't be able to acquire an access token for Graph, which is why it's recommended to use -Interactive.
I have done this multiple times recently and can confirm that it works fine with PnP.PowerShell in PowerShell core.
When you use -Interactive, you will be using the PnP Management Shell Azure app registration to connect as delegated permissions, so ensure that the app is granted permissions (should have requested you to approve the first time using an admin account) and also ensure that the user account has the required permissions on the site.
When you connect using -UseWebLogin, you get an ACS generated token, which will not work for things like exporting the site headed and footer as it won't be able to acquire an access token for Graph, which is why it's recommended to use -Interactive.
I have done this multiple times recently and can confirm that it works fine with PnP.PowerShell in PowerShell core.
When you use -Interactive, you will be using the PnP Management Shell Azure app registration to connect as delegated permissions, so ensure that the app is granted permissions (should have requested you to approve the first time using an admin account) and also ensure that the user account has the required permissions on the site.
RichardS
Aug 11, 2021Copper Contributor
Our Admins found that the current PnP Management Shell screen in Portal.Azure.Com appeared to have changed from when they had originally granted permissions to the app. They noted that the list of potential permissions applicable to PnP Management Shell had increased. We can only surmise that this change had left a number of these ‘new’ permissions in an ‘ungranted’ state, and this is what caused the unauthorisation error.
The problem was fixed by regranting the permissions through the new interface.
The problem was fixed by regranting the permissions through the new interface.
- 27k1ismsSep 05, 2025Copper Contributor
It's 2025 and this worked for me, thanks